Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to browse localhost on Android device?

I try to browse localhost on my HTC Magic. I have connected my device with Eclipse via USB. When browsing http://10.0.2.2 I get "Page not available". I remember, some days ago it worked.

But on the emulator I am able to browse localhost

Any ideas?

like image 231
UpCat Avatar asked Jul 31 '10 14:07

UpCat


People also ask

How can I access localhost from my phone?

You can access your host machine with the IP address "10.0. 2.2". This has been designed in this way by the Android team. So your webserver can perfectly run at localhost and from your Android app you can access it via "http://10.0.2.2:8080".

How do I access localhost?

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.

How do I find my localhost IP Android?

To find your local IP address, click Start>Run>cmd and type ipconfig and your IP address will show up in the output. That's all. Now you can access (open) localhost from Android.


1 Answers

Easier way to check is in browser of emulator type 10.0.2.2 instead of localhost.

like image 82
tosha Shah Avatar answered Oct 08 '22 04:10

tosha Shah