Tech tip of this week

Package Manager in Android

Class for retrieving various kinds of information related to the application packages that are currently installed on the device.

Package: android.content.pm.PackageManager

Android Page:
http://developer.android.com/reference/android/content/pm/PackageManager.html

Source Code:
https://github.com/android/platform_frameworks_base/blob/master/core/java/android/content/pm/PackageManager.java
Use Android package manager pm
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]
Package Manager command line:

Install the package com.twitter.android-1.apk from the SD card
adb shell pm install /sdcard/com.twitter.android-1.apk
List installed packages that contain the term twitter
adb shell pm list packages | grep twitter

Show the install directory of the twitter package
adb shell pm path com.twitter.android


Package Manager stores application information in three files located in /data/system/

1. packages.xml
   This file contains the list of permissions and applications.

2. packages.list
    It is simple text file contain package name, user id ,flag
3. packages-stoped.xml
    This file contain package list which has stopped state.

No comments:

Post a Comment