0

I've been given the task to modify an Android app. It uses an API which is on the main server and right now I don't have access to it. In the source code I changed the URL of the API from

private static String URL = "https://website/App_API/index.php";

to

private static String URL = "http://localhost/App_API/index.php";

in order to make a few tests but after the change the application says that "No internet connection is available". Anyone who has any suggestions how to access the local API?

3
  • did you deployed services correctly at localhost or what??? Feb 11, 2014 at 9:37
  • change localhost with computer ip Feb 11, 2014 at 9:40
  • What do you mean by localhost? where did you deploy the server? Feb 11, 2014 at 9:40

2 Answers 2

2

If you are using emulator, try this

private static String URL = "http://10.0.2.2/App_API/index.php";

Here is the explanation.

0
0

to access the localhost you have to use ip instead ie

String URL = "http://10.0.2.2/App_API/index.php";

see Network Address Space

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.