I have an android device (Samsung galaxy tab) connected to my PC via USB .
I want to use WebServices and run a web page which is located on my local xampp server of my PC on my android device .
I can achieve it if I have both , my PC and android device , connected on the same wireless network .
However is it possible to access the localhost page without any wireless connection , using only USB connection .
(PS : This same scenario works when I run the app on an emulator and use the ip 10.0.2.2 to access the localhost on my PC)
On your mobile device's browser (any will work), navigate to http://<Local IP Address>:<port number> . For example, if I was serving on localhost:8080 and my local IP address is 123.45. 67.890, on my mobile device's browser I would navigate to http://123.45.67.890:8080 .
Open any browser you like and type http://localhost:9999 and it will work like a charm.
With a USB cable, connect your phone to your computer. On your phone, tap the "Charging this device via USB" notification. Under "Use USB for," select File Transfer. A file transfer window will open on your computer.
Google posted a solution for this kind of problem here.
The steps:
3333
on the left part, and type localhost:5000
, and click add rule.I finally solved this problem. I used Samsung Galaxy S with Froyo. The "port" below is the same port what you use for the emulator (10.0.2.2:port). What I did:
http://192.168.x.x:port/test.php
It should now work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With