When developing apps for the Android platform, the necessity of having the test device connected to the computer can get quite annoying. It gets even more inconvenient when you want to keep using the device without detaching and attaching the USB cable all the time, or when one wants to test display orientation changes. What I learned today is that one doesn’t have to keep the device connected via USB at all: Wi-Fi is fully sufficient.
To establish the Wi-Fi connection to the device one has to connect it once via USB yet. Then invoke the following commands:
adb tcpip 7612
adb connect 192.168.2.5:7612
The “adb” program is located within the “platform-tools” sub directory of the Android SDK. The IP address needs to be substituted with the actual address of the Android device, of course. You can detach the device safely after these commands have been entered, without your development work getting affected. ADB will behave just the same as if the device was still connected via USB when you launch or debug the app with Eclipse.
It sufficient to only enter the last line from above in order to establish the Wi-Fi connection during later usage. You will not have to attach the device via USB first again.