0
votes

Hi i can access my laptop web server (http://localhost:8084/...) using the Android emulator, am using this url (http://10.0.2.2:8084/...) in my code to connect and download XML and works fine.

But when I connect my real Android phone, and try to use my App in the phone cannot connect to the server on my laptop. The phone is connected to the laptop using a USB cable. I have tried with different IP in my Code (IP from PC(192.168...), Localhost(127.0.0.1) and 10.0.2.2 ).

UPDATE: Both devices(Laptop and Phone) are connected to my WIFI (Phone 192.168.2.102 and PC 192.168.2.101)

What am I missing? wich IP i must write in my code?

1
If your device and server in the same network area 192.168.... should work. It worked for me.Konstantin Kiriushyn
@KonstantinKiriushyn what i must write in my Java code for accessing Server (IP from Laptop(server):8084/...) is that correct. I have tried with this form and disable Firewall but does not work.Mohammad

1 Answers

0
votes

For that your server and mobile device should be in same wifi network.

You will not access local server using your network provider.

Let me know if I will help you more.