How to connect android application running on a device to a local web application?
I have my droid device connected through USB and using Eclipse for debugging my application running on the device. Everything is fine, except my application needs to connect to a web application running on the same host computer (Windows XP, IE). The web address on the IE was开发者_JAVA技巧 "http://local:4566/MyApp/".
I tried to set my android app to "http://10.0.2.2:4566/MyApp", but no luck. The android app's connection simply times out. The document under http://developer.android.com/guide/developing/tools/emulator.html says that the ip address may be different for devices (see Network Address Space section) but no further details on how to find that.
Question is, how to I connect to a local web application running on my host computer (windows xp) from an Android application connected through USB running debug under Eclipse?
Appreciate any help.
thanks, Guna
Question is, how to I connect to a local web application running on my host computer (windows xp) from an Android application connected through USB running debug under Eclipse?
Use the IP address of the of XP machine. This will only work if the "droid device" and the XP machine are on the same network (e.g., WiFi).
The usb cable is not a 'network' cable and the two machines are separate, really.
you need to create an ad hoc network between the local host and the android device. search for "windows create ad hoc network" depending on your windows version. when set up, your android can see it in its access point list.
p.s. as for debugging, set the security type to minimum, so that you dont need any additional tweaks.
Get the IP address of your device by going to a website such as http://www.whatismyip.com using your device. This will allow you to know what the actual IP address of your device is.
精彩评论