Android Debug Bridge Mode

AndroidMobile Development

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The ADB is typical, used to communicate with a smartphone, tablet, smartwatch, set-top box, or any other device that can run the Android operating system. We can do things on an Android device that may not be suitable for everyday use, like, install apps outside of the Play Store, debug apps, access hidden features, and bring up a UNIX shell, etc. For security reasons, Developer Options need to be unlocked and you need to have USB Debugging Mode enabled as well. Not only that, but you also need to authorize USB Debugging access to the specific PC that you’re connected to with a USB cable. It is a client-server program that includes three components −

  • A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.

  • A daemon, which runs commands on a device. The daemon runs as a background process on each device.

  • A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.

How it works

After starting an adb client in the kali Linux terminal, the client first confirms whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server. The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, the range used by the first 16 emulators. Where the server finds an adb daemon, it sets up a connection to that port.

Note − To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. The Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.

Connection

  • After enabling the developer option in the android device, connect it to the PC with the USB cable. However, we can make a connection through Wi-Fi too.

  • Open the terminal in the Kali Linux

  • Connect to the device by its IP address which is found at Settings > About tablet (or About phone) > Status > IP address

    :/> adb connect ‘ip address’

  • After that, confirm that your host computer is connected to the target device by the following command; it shows the serial number of the connected devices.

    :/> adb devices

ADB Commands

The user can perform multiple types of operator once a connection is established to the android device. Here, the list of commands to communicate with device as following

CommandComments
adb devicesPrint the connected devices
Adb kill-serverKill the adb Server
adb rootTo get root access
adb wait-for-devicesWait for adb devices
adb shell stop thermal-engineStopping system service /system/bin/thermal-engine
Adb installInstall an application in adb
adb shellInitiate a shell
Sadb shell dumpsysShows memory consumption details
adb shell echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governorPut the cpu1 scaling governor to performance mode
Adb pullCopy a file or directory from the device
Adb pushCopy a file or directory to the device
Adb forwarding tcp:6100:7100Port forwarding
raja
Published on 29-Sep-2020 14:26:36
Advertisements