In the meantime, if you need to run one of these ADB commands, you must have a USB cable. As long as you have not connected your device to a PC via USB, you can not execute any of these ADB commands. Or is a general notion. But today, I discovered an awesome hack that lets you run any ADB command on your device via a WiFi network without using a USB cable. But before starting the same thing, you have to keep in mind some important prerequisites.
- Download and install the tools of the Android SDK platform on your desktop. If you have a problem installing it on Windows 10, you can refer to our guide.
- Enable USB debugging on your device. Go to Settings > About the phone > Tap on Construction number 7 times> Back to Settings > Developer options > Activate the USB debug switch. For more explanations, check out our guide on how to enable USB development and debugging options on Android.
- For this trick to work, your device and your PC must be connected to the same Wi-Fi network.
These were the important requirements to keep in mind. Now let's see how to run ADB commands over WiFi without a USB cable.
Execution of ADB orders by WiFi
To configure the process, connect your device to USB. This is only a one-off requirement. In addition, you must keep a note of your IP address on your Android device. If you're using Android 9.0 Pie or later, go to Settings > Network and Internet > Wireless > Tap on the WiFi connected > Advanced > Note your IP adress.
However, for Android 8.0 Oreo or earlier versions, the method is slightly different. Go to Settings > About the phone > Status > IP adress. Now let's start the process of running ADB commands over WiFi without a USB cable.
- Go to Android SDK and platform tools folder. In the same folder, type cmd in the address bar.
- This will open the Command Prompt window. You can perform this procedure in the PowerShell window as well. For this, in the folder platform-tools, right-click on a blank space while pressing the key shift key. Now click on Open the PowerShell window here.
- If this is the first time, you will need to authorize your device for an ADB connection. A dialog box appears on your device when you connect via USB. Press on Always allow from this computer.
- Now, type the code below to check if the ADB connection was successful. if you get an alphanumeric code, the device is connected successfully:
- Before typing the adb below command, make sure your device and your PC are connected to the same Wi-Fi network. Now type in the code below:
adb tcpip 5555
- Then enter the following code to connect your device to ADB via WiFi without USB cable.
For example, my IP address being 192.168.0.2, the command in my case will be the following. You can also see the image above for reference.
adb connect 192.168.0.2:5555
- That's it. You can now run any ADB command on the WiFi without the need for a USB cable.
Things to keep in mind
If you connect your device via a USB cable and type adb peripheralsyou will get two device IDs. One will come in the form of an IP address, with the suffix: 5555 (tcpip). The other will be the alphanumeric code. The latter is the result of a USB cable while the first is due to WiFi, as shown by the IP address.
If you want to remove the WiFi device ID, closing and reopening the command shell will do nothing. For that, you will have to kill the process. Type the code below in the command prompt to delete the same:
ADB commands via WiFi when the device is turned on
Until now, we have discussed how to run ADB commands via WiFi without any USB cable. Let's take a look at some of the important ADB commands that can be executed in this wireless mode.
Displays a list of all devices connected to the PC in ADB state.
Used to restart your Android device
To restart your device in boot / fast boot mode, you can use this command.
To boot your device to store or perform a custom recovery such as TWRP (if installed).
Another useful ADB command that can be run on WiFi without using a USB cable. It is used to install an APK on your Android device directly from the PC. Just be sure to move the APk file to the platform-tools folder before running the code below. If the file name is game.apk, the command will be:
adb install game.apk
Likewise, to uninstall an APK from your Android device, type the code below. To get the ID of any application, search for the desired application on Play Store on Desktop. In the address bar, copy the content next to id =. To uninstall WhatsApp, the code will be:
adb uninstall com.whatsapp
Extract a file from your device and save it to your desktop. The file would be saved in the platform-tools folder. For example, to extract video.mp4, the command will be
adb pull /sdcard/video.mp4
Used to send a file to your device from your PC. Keep the file in the platform-tools folder to place it on your device.
adb push video.mp4 /sdcard
Above, some of the adb commands. For a complete list of all these commands, see the list of ADB and Fastboot commands for Android..
With this, we conclude the guide on how to execute ADB commands on WiFi without using a USB cable. Let us know if you have problems during the process. Your views are also welcome on this very useful tip.
Read more: How to track the source IP address of the e-mail address