Developing mobile apps using Apache Cordova or any other platform involves constantly deploying your app to real devices. This process can become tedious because the phone or tablet must be connected via USB cable to your computer. However, you can connect your device via WiFi and deploy and debug your app normally following these steps.
Connecting Android via WiFi to adb
- Connect your device normally via USB cable and open a command prompt.
- Ensure the connection is successful by typing adb devices
- Type adb tcpip 5555 to switch ports.
- If another device is already connected, specify the target device as follows: adb -s DEVICE_ID tcpip 5555, where DEVICE_ID is the device name shown by adb devices.
- You’ll get the message: restarting in TCP mode port: 5555 after a few seconds.
- Find out the device’s current WiFi IP address. Since Android keeps changing the GUI, the process of locating the IP depends on your android version, you can try:
- Tap and hold the WiFi icon and tap your current network.
- Go to WiFi > Advanced, and locate the IPv4 address label.
- Disconnect the USB cable.
- Type adb connect 192.168.0.x to connect the device wirelessly.
- Type adb devices to check if your device was connected succesfuly.
Below is a sample command line with the previous commands executed. The device is now connected by WiFi and you can deploy and debug your apps normally, without cables.
To disconnect, type adb disconnect in the command line, or restart your device.
If your device does not appear in the list, or you get connection errors, restart either Windows and / or the device itself and retry the process.
Connecting iPhone via WiFi to Xcode
- Connect your device normally via USB cable
- Open Xcode and go to Window > Devices and Simulators
- Check the Connect via Network option and wait a few seconds
- Disconnect the USB cable
- Your device should still appear in the Devices list while connected via WiFi
If you receive errors connecting the device via WiFi or it does not appear to be connected anymore, restart the device and Xcode. If the problem persists, try to restart your Mac as well.
The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.