I have an Android app running on a phone that's connected to a host machine over USB. The phone will always be connected to the machine and I need to go an HTTP request to the machine. Working in the emulator, I can access the webserver running on the computer using the IP address of 10.0.2.2 and that works fine. However running the same app on the phone, I get a SocketException
of Network unreachable
. The phone doesn't have a SIM card in it, nor does it have a wifi connection, I need the HTTP request to just go over USB to the computer. Is this at all possible? If so, what am I doing wrong.
I'm using standard HttpClient code, nothing special, which works absolutely fine if I run it on the phone using a wifi connection, so I know that's not the problem.