How to use the Android PM command

Source: Internet
Author: User

when Sam looked at the relevant Packagemanager code, he inadvertently found that a PM command was provided under Android, usually placed under/system/bin/. This command is related to the package and is very useful. So the study.


0. Usage:
USAGE:PM [List|path|install|uninstall]PM list packages [-f]PM List permission-groupsPM List permissions [-G] [-f] [-d] [-u] [GROUP]PM list instrumentation [-f] [Target-package]PM List FeaturesPM Path PackagePM install [-l] [-r] [-T] [-I installer_package_name] [-S] [-f] PATHPM Uninstall [-K] Package PM Enable Package_or_componentPM Disable Package_or_componentPM Setinstalllocation [0/auto] [1/internal] [2/external]
The list Packages command prints all packages.Options:-f:see their associated file.
The list permission-groups command prints all knownpermission groups.
The list Permissions command prints all knownpermissions, optionally only those in GROUP.Options:-g:organize by group.-f:print all information.-s:short Summary.-d:only List dangerous permissions.-u:list only the permissions users would see.
The list Instrumentation command prints All instrumentations,or is those that target a specified package.Options:-f:see their associated file.
The list features command prints all features of the system.
The path command prints the path to the. apk in a package.
The install command installs a package to the system.Options:-l:install the package with Forward_lock.-r:reinstall an exisiting app, keeping it data.-t:allow test. APKs to be installed.-i:specify the installer package name.-s:install package on SDcard.-f:install package on internal flash.
The uninstall command removes a package from the system. Options:-k:keep the data and cache directories around.after the package removal.
The Enable and disable commands change the enabled state OFA given package or component (written as "Package/class").
The getinstalllocation command gets the current install location0 [Auto]: let system decide1 [internal]: Install on internal device storage2 [external]: Install on external media
The setinstalllocation command changes the default install location0 [Auto]: let system decide1 [internal]: Install on internal device storage2 [external]: Install on external media


1. Specific Use methods:
1.1: Look at the installed packages:
pm List Package
This displays all installed package names.

pm List package-f
also displays the directory where the associated file is located (that is, the saved apk file)

1.2: Look at a known permission group:
pm List permission-groups

1.3: See all known Permissions:
pm List Permissions

1.4:list all hardware-related information:
pm List features

The results are usually similar:
Feature:reqglesversion=0x20000feature:android.hardware.bluetoothfeature:android.hardware.camerafeature: Android.hardware.locationfeature:android.hardware.location.networkfeature:android.hardware.microphonefeature: Android.hardware.sensor.accelerometerfeature:android.hardware.sensor.compassfeature: Android.hardware.touchscreenfeature:android.hardware.wifi

1.5: The associated file (apk archive file) that lists the specified package name:
For example:
pm Path com. Tdijoy.fane
package:/mnt/asec/com. tdijoy.fane-1/pkg.apk


1.6: Install APK:
pm Install [-l] [-r] [-T] [-I installer_package_name] [-S] [-f] PATH

path refers to the absolute path and file name of the APK file.

For example:
pm install/data/3dijoy_fane.apk

these several parameters are useful:
- R: Install an already installed APK to keep its data intact.
-I: Specifies the package name for the installation. (did not try to come out)
- s: Installed on SDcard.
-F: Install to internal flash.



1.6: Uninstall APK:
pm Uninstall package name.
For example:
pm Uninstall com. Tdijoy.fane


1.7: Get and set the default installation location:
The getinstalllocation command gets the current install location0 [Auto]: let system decide1 [internal]: Install on internal device storage2 [external]: Install on external media
The setinstalllocation command changes the default install location0 [Auto]: let system decide1 [internal]: Install on internal device storage2 [external]: Install on external media

PmGetinstalllocation
Get the default installation location.

Set up:
PM Setinstalllocation <0|1|2>

0: Automatic.
1: Internal Flash.
2: Extended storage device.






Example: How to install the APK into a USB flash drive on Hisense 2.2 STB:
Sam first tries to use:
PM Setinstalllocation 2
After installation, it is useless.

Later try to do the following:

  in other settings -Storage Devices -make a selection of default storage devicesUdisk is the default storage device.

# pm Install-s xxxx.apk


will be successful.
Reprint: http://blog.sina.com.cn/s/blog_602f877001018b94.html

How to use the Android PM command

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.