Pedro Gonzalez
Pedro Gonzalez

Reputation: 1459

Access localhost from Android device

I have a server in xampp in os x laptop, when I type: 10.0.2.2/myphpServer in the emulator web navigator, goes ok, but from a usb-connected real android device, I can not connect.

Upvotes: 2

Views: 1152

Answers (3)

Jameel Mohammed
Jameel Mohammed

Reputation: 2364

Check public ip of your pc by ifconfig command in terminal then use YOUR_IP/myphpServer
If you are in local network (router or LAN) then use your local_ip/myphpServer (make sure your mobile is also in same network)

If your mobile doesn't have internet connection then go for Android USB Tethering

Upvotes: 2

Meyka Jograt
Meyka Jograt

Reputation: 314

Better use the IP Address of your laptop type in cmd ipconfig search for Local Area Connection: IPv4 Address

Upvotes: 0

Sushmit Patil
Sushmit Patil

Reputation: 1465

You need to connect both device to same network to access localhost in Android device.

Upvotes: 0

Related Questions