Accessing Localhost From Android Over Wifi
Solution 1:
You can get a public URL for your server running on a specific port on localhost.
At my work place I could access the local server by using the local IP address of my machine in the app, as most of the other answers suggest. But at home I wasn't able to do that for some reason. After trying many answers and spending many hours, I came across https://ngrok.com. It is pretty straight forward. Just download it from within the folder do:
ngrok portnumber
( from command prompt in windows)
./ngrok portnumber
(from terminal in linux)
This will give you a public URL for your local server running on that port number on localhost. You can include in your app and debug it using that URL.
You can securely expose a local web server to the internet and capture all traffic for detailed inspection. You can share the URL with your colleague developer also who might be working remotely and can debug the App/Server interaction.
Hope this saves someone's time someday.
Solution 2:
I found a quick solution to this problem. try this link, it should help you guys fix the problem. http://www.mobitechie.com/android-2/how-to-access-localhost-on-android-over-wifi/
I only changed 1 thing, where the tutorial states you change '127.0.0.1' to 'All', change it to the ip address your server is running on instead.
after that you should be able to connect to your localhost.
Solution 3:
I was also looking for something similar from desktop type ipconfig you will get desktopIP now put that in android browser you should get your localhost
Post a Comment for "Accessing Localhost From Android Over Wifi"