I'm developing client/server software for Android.
While connected to the phone via USB debugging, I'd like to access the webserver I'm running on my developement PC - using the USB connection.
Is that possible and if so, how ?
|
I'm developing client/server software for Android. While connected to the phone via USB debugging, I'd like to access the webserver I'm running on my developement PC - using the USB connection. Is that possible and if so, how ? |
|||
|
|
|
I stumbled upon the answer after a night sleep. Enabling USB tethering on my phone (N1, 2.2.1) gives it and the host computer an IP address. The phone can communicate with my web server running on my developement machine! (Chris, the rumors are right) Just make sure your web server is listening on that IP address. For apache, use the line
or
(x.x.x.x being address of your android tunnel) |
|||||||||||||
|
|
The easiest way to do it is via wireless. If you don't have wireless, I'd say bite the bullet and get it, it's going to be a necessity for testing anyway :) |
|||
|
|
|
Typically the USB only supports connections from the development machine to the phone (via adb port forwards) and not the other way around. Of course once a connection is created data can move bidirectionally. One could use this to build a tunneling proxy web proxy (one connection in from the development machine to a daemon running on the phone, outbound connections from the phone then tunnel through this) I have heard rumors though that what you want to do - often called reverse tethering - may be supported in some more recent devices. Kevin's wifi suggestion may be the simplest with a real device. On the other hand, unlike typical phones, the android emulator can directly access the development machine's loopback interface at an alias address given in the documentation. |
|||
|
|