Android Next PM Command detailed

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-GROUPS       PM List permissions [-G] [-f] [-d] [-u] [group]       pm list instrumentation [-F] [ TARGET-PACKAGE]       PM List features        PM path PACKAGE       PM Install [-l] [-r] [-T] [-I installer_package_name] [- S] [-f] path       pm Uninstall [-K] package        PM Enable package_or_component       pm Disable Package_or_component        PM 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 Knownpermiss Ions, optionally only those in GROUP.  options:  -g:organize by Group.  -f:print all Information.  -s:short summary.& Nbsp; -d:only List Dangerous permissions.  -u:list only the permissions users would see. the list ins trumentation command Prints All instrumentations,or is those that target a specified the 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 for a package. the install command installs a package to the system .  options:  -l:install the Forward_lock.  -r:reinstall an exisiting app, keeping I TS Data.  -t:allow test. APKs to being installed.  -i:specify the installer package name.  -s : Install PackagE on Sdcard.  -f:install-Internal flash. the Uninstall command removes a package from the Syste M. options:  -k:keep the data and cache directories Around.after the package removal. the enable and Disab Le commands change the enabled state OFA given package or component (written as "Package/class").  the Getinstalllocat Ion command gets the current install location  0 [auto]: Let system decide the best location  1 [Inter NAL]: Install on internal device storage  2 [external]: Install on external media the Setinstalllocation Co Mmand changes the default install location  0 [Auto]: Let system decide the best location  1 [internal ]: Install on internal device storage  2 [external]: Install on external media

1. Specific Use method :
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: Look at all known permissions :
PM List Permissions

1.4: Lists 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: Lists the   associated  file   (apk archive file) for 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 parameters are useful:
-r: Install an installed APK to keep its data intact.
-I: Specifies the package name for the installation. (did not try to come out)
-S: Install on SDcard .
-F: Installed on internal flash.

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

1.7: Gets and sets the default installation location:

The getinstalllocation command gets the current install location 0 [auto]: Let system decide the best location 1 [Intern AL]: Install on internal device Storage 2 [external]: Install on external Media the setinstalllocation command changes th E default install location 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device Storag e 2 [external]: Install on external media

PM Getinstalllocation
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:

Select the USB flash drive as the default storage device in the default storage device, such as storage device, other settings.

# PM Install-s xxxx.apk


will be successful.

Android Next PM Command detailed

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.