I’m sending a POST to my development machine and it works with 10.0.2.2 in the emulator, but I can’t get it to work when installed on my phone – the connection always times out. I tried 10.0.2.2, 192.168.1.3 (my computer) and my public IP..
I turned off the firewall and I tried forwarding port 8000 which is the port my web server is listening on.
Which IP should it be? Is port forwarding what I need to do? I have no clue how routers and my internal network work.
As you are using the same connection for your pc as well as emulator so as a result you can browse 10.0.2.2(aka localhost)
But when you are deploying it in a real handset you are facing the problem.
Make sure that your device and server share the same connection.
Use WIFI so that your device can detect 192.168.1.3
Hope it will help you