I have set up a very simple app to do a GET from a http server I have running on my pc. The GET just responds with a simple hello string. Initially I was having trouble accessing the url from the emulator as I was using localhost:8080 but read on this forum to use 10.0.2.2:8080 and it works fine from my emulator.
I don't know how this works but that's for another day
Now when I connect my phone via the usb, and install the apk file the app starts up fine but it never calls into my server. (I have the internet option switched on and can pull data back from google.co.uk if I use
HttpResponse response = client.execute(request); )
Question is how do I talk to my web server running on my pc from the phone. Really stuck on this one and cannot find any worked example anywhere and this would be the final peice in the jigsaw before I get into the coding.
Hauke Ingmar Schmidt
posted 6 years ago
james frain wrote:I don't know how this works but that's for another day
If I get your problem correctly then this is the solution. You need to understand how addresses are routed and how hostnames are resolved to use the networking classes correctly. Some addresses are private and can't be reached from "outside" like your phone but only from "inside" the same subnet like the emulator.
The glass is neither half full or half empty. It is too big. But this tiny ad is just right: