My web application runs in localhost server. In my emulator the URL is http://localhost:8080/myaction
Is it possible to retrieve the information from the server?
If you're using Android Studio to run the emulator, then localhost of your host computer will be mapped to the IP address, 10.0. 2.2 , inside the emulator. If you're using other programs to run the emulator, then you may need to consult the documentation associated with those programs.
Use 10.0. 2.2 to access your actual machine. As you've learned, when you use the emulator, localhost ( 127.0. 0.1 ) refers to the device's own loopback service, not the one on your machine as you may expect.
After gathering the IP address and the port number, enter the URL in the format IP address: port number, and you will be able to access the local website on the mobile device/devices.
To access the server from itself, use http://localhost/ or http://127.0.0.1/ . To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server's local IP address. You can find the sever's local IP address (assuming it's Linux) by running hostname -I . 127.0.
Localhost is device's own loopback interface, if you're trying to access your development machine use 10.0.2.2.
More about it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With