Android am PM command

Source: Internet
Author: User

Today, I have read the am PM command in ADB shell, some of my own opinions, and most of the translations on the official website.

Let's talk about the am command, which is short for activity manager. You can use am to simulate various system behaviors, such as starting an activity, forcibly stopping the process, and sending broadcast processes, modify device screen properties. When you run the am command under the ADB shell command:

am <command>

You can also run the am command before the ADB shell:

adb shell am start -a android.intent.action.VIEW

Introduction to some am commands:

Start [Options] <intent>: Start an activity by using the specified intent parameter. For specific intent parameters, refer to the official table.

Startservice [Options] <intent>: start the service using the specified intent parameter. The specific intent and start command parameters are the same.

Force-Stop <package>: Force stop a specified package application.

Kill [Options] <package>: Kill the application process of the specified package. This command kills the process in safe mode without affecting the user experience. Parameter options: -- User <user_id> | all | current: specify that the user process is killed. If this parameter is not specified, all users are killed by default. (We will introduce user_id below)

Kill-ALL: Kill all background processes.

Broadcast [Options] <intent>: Send an intent. For specific intent parameters, refer to the start command parameters. Parameter options: -- User <user_id> | all | current: specify that the user process is killed. If this parameter is not specified, all users are killed by default.

Instrument [Options] <component>: Test command, which is not described in detail.

Profile start <process> <File>: Run profile in the <process> process and write the analysis result to <File>.

Profile stop <process>: Stop profile.

Set-debug-app [Options] <package>: Set the package application to debug mode. Parameter options:-w | -- persistent: waiting to enter the debugging mode, retain the value.

Clear-debug-app: Clear the package application set with the set-debug-app command.

Run the following command to view the official website:

Monitor [Options]
Screen-compat [ON | off] <package>
Display-size [reset | <WXH>]
Display-density <DPI>
To-Uri <intent>
To-intent-Uri <intent>

Next we will introduce the PM command, which is full name of package manager. You can use the PM command to simulate Android behaviors or query applications on the device. When you run the PM command under the ADB shell command:

pm <command>

You can also run the PM command before the ADB shell:

adb shell pm uninstall com.example.MyApp

Introduction to some PM commands:

List packages [Options] <filter>: print all packages and select a list of packages. Parameter option:-F: view the associated file, that is, the location of the application APK and the corresponding package name (for example, package:/system/APP/musicplayer.apk = com. sec. android. app. music);-D: View disabled packages;-E: View enable package;-S: view system package;-3: View third-party package;-I: check the installer (for example, package: COM. tencent. qqmusic
Installer = NULL 2. Package: COM. Tencent. qqpim Installer = com. Android. Vending);-u: view the uninstalled package. (It will still be included after uninstallation and re-installation); -- User <user_id>: the user space to query.

List permission-groups: print all known permission groups.

List permissions [Options] <group>: select the print permission. Parameter options:

List features: device features. Performance of hardware.

List libraries: The libs supported by the current device.

List users: all users on the system. (The user_id query method mentioned above, for example: userinfo {0: Primary: 3}, then user_id is 0)

Path <package>: query the package installation location.

Install [Options] <path>: Installation command.

Uninstall [Options] <package>: uninstall command.

Clear <package>: deletes all data from the specified package.

Enable <package_or_component>: Make the package or component available. (For example, PM enable "package/class ")

Disable <package_or_component>: Make the package or component unavailable. (For example, PM disable "package/class") (disable the specified package, but getcomponentenabledsetting the components in the package is still in the enable state. Disable-user is the same principle .)

Disable-user [Options] <package_or_component>: Parameter options: -- User <user_id>: the user to disable.

Grant <package_permission>: authorize the application.

Revoke <package_permission>: revoke permissions.

Set-install-location <location>: Set the default installation location. 0: the system automatically selects the best installation location. 1: Install it to the internal device storage space. 2: Install it to an external device storage space. (This is only used to debug the application. Using this command may cause the application to exit or cause other discomfort ).

Get-install-location: returns the current installation location. The returned result is the same as the preceding parameter.

Set-permission-enforced <permission> [true | false]: enable or disable the specified permission.

Create-user <user_name>: Add a new user.

Remove-user <user_id>: delete a user.

Get-max-users: Maximum number of users supported by the device. (Some devices do not support this command)

Some of the preceding commands may require root permissions.

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.