Use and interpretation of ADB commands

Source: Internet
Author: User
Tags cpu usage

ADB tool (full name: Android Debug Bridge) is an Android generic debugging tool that provides instructions for debugging Android-related operations

ADB devices Directive

ADB devices instructions to obtain information about the device or emulator that is currently connected

Such as:

The first message is the phone device serial number, the second is the connection status

There are three connection states: Device, offline, no device

Device status: Indicates that the current device or emulator is connected to the ADB server

Offline Status: Indicates that the device or emulator is not connected to the ADB server or is not responding

No device status: Indicates no devices or emulator connections

adb Install command

The adb install command is to install the application to the device or emulator using the

Contains two parameters:

-s Specifies the device serial number or emulator serial number to be installed, and when multiple devices are connected, you need to specify which device or emulator to install the application to, which can be set by-s

Syntax format: adb-s phone serial number/simulator serial number Install D:\XXX.APK

-R for overwrite installation (when you have installed an identical APK app and do not want to uninstall it, reinstall it via-R setting)

Syntax format: ADB-R phone serial number/simulator serial number Install-r D:\xxx.apk

adb uninstall directive

ADB uninstall means uninstalling installed applications

Syntax format: ADB-S device serial number uninstall app package name

The app package name can be found under the Data/data directory in adb shell mode with root privileges

Enter adb shell mode: adb shell

Switch root user: su root

View Data/data Directory App package: Ls/data/data

ADB Pull Command

ADB pull instructions can transfer files on the phone to the local computer for operation (e.g., some runtime error log files, configuration files, etc.)

Syntax format: ADB pull phone file path Local computer file path such as: ADB Pull/sdcard/tmp/a.log d:/telephone/og

ADB push command

The ADB push command uploads the local computer files to the phone

Syntax format: ADB-S device serial number push D:\script/t.mr/script

adb shell command

The Android system is based on Linux systems, so the commands that are common to Linux are supported, which can be found in the/system/bin directory. As follows:

There are two ways of using the ADB shell:

First, use the ADB shell + command directly, such as: adb shell ls

Second, use the ADB shell to enter the shell mode, using the command. As follows:

adb shell dumpsys battary directive

ADB shell Dumpsys battery is used to view battery charge information

Detailed output information:

AC Powered:false indicates that no power charge is currently being used

USB powered:true indicates that USB charging is currently used

Status:2 indicates current charging status (5 indicates full charge)

Health:2 indicates current battery health status, 2 indicates current battery health status-good

Level:98 indicates the current remaining power, 98 indicates the current device has a remaining charge of 98%

SCALE:100 indicates that the current device supports a maximum power of 100

voltage:4325 indicates that the current battery voltage is 4325 mv (MV)

temperature:213 indicates that the current battery temperature is 21.3 degrees, in units of 0.1 degrees. 213*0.1=21.3 degree

Technology:li-poly says the battery is powered by a lithium battery

adb shell dumpsys wifi command

ADB shell Dumpsys WiFi is to view the current WiFi connection situation

Wi-Fi is disabled: current WiFi is off (disabling-current wifi is off, enabled-current wifi is enabled, enabling-current WiFi boot, unknown-unknown WiFi status)

adb shell dumpsys telephony.registry Directive-View phone-related information

Mcallstate:0, indicates the standby state, 1 indicates that the call has not been answered, 2 indicates the line is busy

Mcallincomingnumber: The phone number that represents the most recent call

Mservicestate: Indicates service status, 0 indicates normal use

Msignalstrangth: Indicates strong signal information

Mmessagewaiting: Indicates whether the radio message is waiting

Mcallforwarding: Indicates whether call forwarding is enabled

Mdataactivity: Indicates a wireless data call condition, 3 means that the IP PPP signal is being sent and received

Mdataconnectionstate: Indicates wireless data connection condition, 2 indicates connected

Mdataconnectionpossible: Indicates whether there is a data connection

Mdataconnectionreason: Indicates the reason for the data connection

MDATACONNECTIONAPN: Indicates the access point name

Mdataconnectionlinkproperties: Link property that represents a data connection

Mdataconnectionnetworkcapabilities: The ability to represent a data link connection

Mcelllocation: Indicates base station related information

adb Shell cat/proc/cpuinfo instructions-View CPU hardware information

adb Shell cat/proc/meminfo Instructions-View memory information

adb Shell Cat/proc/iomem Instructions-view I/O partition related information

adb Shell cat/proc/version Instructions-View phone kernel version information

adb shelll DF Instruction-View each partition information on your phone's Android system

adb Shell dumpstate Instructions-View the current status information of the phone system (including system build, network related, memory usage, CPU usage, process, etc.)

adb get-serialno Instructions-Get the serial number of the device

adb get-state Instructions-View the status of the current device or emulator

adb start-server command-start ADB service

adb kill-server command-close ADB service

adb forward Instructions-redirect the port on the computer to the emulator or mobile device port

AM Instruction

AM (Activity Manager) uses AM to simulate the behavior of various systems, such as initiating a camera function

ADB shell am start-n com.sec.android.app.camera/. Camera Start camera function

You can also simulate a vulnerability environment:

ADB shell am broadcast-a android.internt.action.BATTERY_CHANGED--ei "level" of--ei "scale" 200

PM instructions

PM can be used to simulate Android behavior or device applications using PM commands

such as open all packages list

ADB Shell PM List Package

Parameters:

-F View its associated files

-D View Disabled package

-E View Enable package

-S View System Package

-3 View Third party Package

-I view package corresponding installers

-U View the package that has been uninstalled

ADB command usage and interpretation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.