Android pm command usage

Source: Internet
Author: User

Android pm command usage
When Sam looks at the relevant PackageManager code, he accidentally finds that a pm command is provided in Android, usually in/system/bin. This command is related to Package and is very useful. So the research.


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 known permission groups.
The list permissions command prints all known permissions, 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 will see.
The list instrumentation command prints all instrumentations, or only 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 of a package.
The install command installa package to the system.Options:-L: install the package with FORWARD_LOCK.-R: reinstall an exisiting app, keeping its 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 of a given package or component (written as package/class ).
The getInstallLocation command gets the current install location0 [auto]: Let system decide the best location1 [internal]: Install on internal device storage2 [external]: Install on external media
The setInstallLocation command changes the default install location0 [auto]: Let system decide the best location1 [internal]: Install on internal device storage2 [external]: Install on external media


1. Usage:
1.1: View installed packages:
Pm list package
The names of all installed packages are displayed.

Pm list package-f
The directory where the associated file is located (that is, the saved APK file) is also displayed)

1.2: view known permission groups:
Pm list permission-groups

1.3: view all known permissions:
Pm list permissions

1.4: list all hardware information:
Pm list features

The results are generally similar:
Feature: reqGlEsVersion = 0x20000 feature: android. hardware. bluetooth feature: android. hardware. camera feature: android. hardware. location feature: android. hardware. location. network feature: android. hardware. microphone feature: android. hardware. sensor. accelerometer feature: android. hardware. sensor. compass feature: android. hardware. touchscreen feature: android. hardware. wifi

1.5: listAssociatedFile (APK archive file)Location:
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 indicates 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 unchanged.
-I: Specifies the package name to be installed. (Failed)
-S: install it on SDCard.
-F: install it on the Internal Flash.



1.6: uninstall APK:
The name of the pm uninstall package.
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 decide the best location1 [internal]: Install on internal device storage2 [external]: Install on external media
The setInstallLocation command changes the default install location0 [auto]: Let system decide the best location1 [internal]: Install on internal device storage2 [external]: Install on external media

PmGetInstallLocation
Get the default installation location.

Settings:
Pm setInstallLocation <0 | 1 | 2>

0: automatic.
1: Internal Flash.
2: extended storage devices.



Example: how to install APK to a USB flash drive on Hisense 2.2 STB:
Sam first tries to use:
Pm setInstallLocation 2
It is useless to install it later.

Later, I tried the following:

Choose "other settings"> "Storage Device"> "specify the default storage device" and select "USB flash drive" as the default storage device.

# Pm install -S xxxx.apk


Then you can succeed.

Related Article

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.