Android device connection with localhost server

11,828

As stated in the first comment, you should check your file AndroidManifest.xml.

In order to access the network, it should contain the following instructions :

<uses-permission android:name="android.permission.INTERNET" />

You may also add the following, which enable your application to know the actual state of the network connection.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Share:
11,828
Birat Bade Shrestha
Author by

Birat Bade Shrestha

Learning something new everyday.

Updated on June 07, 2022

Comments

  • Birat Bade Shrestha
    Birat Bade Shrestha almost 2 years

    I am new at android. I am devloping an app that uses MySQL. The application runs well in the emulator. But now I need to run the app in a android device. What can I do.

  • Admin
    Admin over 10 years
    "The application runs well in the emulator" means permission are already written in Manifest file.
  • jeromedt
    jeromedt over 10 years
    Ok, fine ; but was it really necessary to push the -1 button ? I did not know that trying to honestly help the submitter was a wrong action...though my answer did not bring more light to the topic.