PackageInfo

open class PackageInfo : Parcelable
kotlin.Any
   ↳ android.content.pm.PackageInfo

Overall information about the contents of a package. This corresponds to all of the information collected from AndroidManifest.xml.

Summary

Constants
static Int

Constant corresponding to auto in the android.R.attr#installLocation attribute.

static Int

Constant corresponding to internalOnly in the android.R.attr#installLocation attribute.

static Int

Constant corresponding to preferExternal in the android.R.attr#installLocation attribute.

static Int

Flag for #requestedPermissionsFlags: the requested permission is currently granted to the application.

Inherited constants
Public constructors

Public methods
open Unit
writeToParcel(dest: Parcel!, parcelableFlags: Int)

open Unit
setLongVersionCode(longVersionCode: Long)

Set the full version code in this PackageInfo, updating #versionCode with the lower bits.

open Long

Return versionCode and versionCodeMajor combined together as a single long value.

open String

open Int

Properties
Array<ActivityInfo!>!

Array of all &lt;activity&gt; tags included under <application>, or null if there were none.

ApplicationInfo!

Information collected from the <application> tag, or null if there was none.

Int

The revision number of the base APK for this package, as specified by the <manifest> tag's revisionCode attribute.

Array<ConfigurationInfo!>!

Application specified preferred configuration &lt;uses-configuration&gt; tags included under <manifest>, or null if there were none.

Array<FeatureGroupInfo!>!

Groups of features that this application has requested.

Long

The time at which the app was first installed.

IntArray!

All kernel group-IDs that have been assigned to this package.

Int

The install location requested by the package.

Array<InstrumentationInfo!>!

Array of all &lt;instrumentation&gt; tags included under <manifest>, or null if there were none.

Long

The time at which the app was last updated.

String!

The name of this package.

Array<PermissionInfo!>!

Array of all &lt;permission&gt; tags included under <manifest>, or null if there were none.

Array<ProviderInfo!>!

Array of all &lt;provider&gt; tags included under <application>, or null if there were none.

Array<ActivityInfo!>!

Array of all &lt;receiver&gt; tags included under <application>, or null if there were none.

Array<FeatureInfo!>!

Features that this application has requested.

Array<String!>!

Array of all &lt;uses-permission&gt; tags included under <manifest>, or null if there were none.

IntArray!

Array of flags of all &lt;uses-permission&gt; tags included under <manifest>, or null if there were none.

Array<ServiceInfo!>!

Array of all &lt;service&gt; tags included under <application>, or null if there were none.

String!

The shared user ID name of this package, as specified by the <manifest> tag's sharedUserId attribute.

Int

The shared user ID label of this package, as specified by the <manifest> tag's sharedUserLabel attribute.

Array<Signature!>!

Array of all signatures read from the package file.

SigningInfo!

Signing information read from the package file, potentially including past signing certificates no longer used after signing certificate rotation.

Array<String!>!

The names of any installed split APKs for this package.

IntArray!

The revision number of any split APKs for this package, as specified by the <manifest> tag's revisionCode attribute.

Int

String!

The version name of this package, as specified by the <manifest> tag's versionName attribute.

static Parcelable.Creator<PackageInfo!>!

Constants

INSTALL_LOCATION_AUTO

added in API level 21
static val INSTALL_LOCATION_AUTO: Int

Constant corresponding to auto in the android.R.attr#installLocation attribute.
Requires API level 21 (Android 5.0, Lollipop)

Value: 0

INSTALL_LOCATION_INTERNAL_ONLY

added in API level 21
static val INSTALL_LOCATION_INTERNAL_ONLY: Int

Constant corresponding to internalOnly in the android.R.attr#installLocation attribute.
Requires API level 21 (Android 5.0, Lollipop)

Value: 1

INSTALL_LOCATION_PREFER_EXTERNAL

added in API level 21
static val INSTALL_LOCATION_PREFER_EXTERNAL: Int

Constant corresponding to preferExternal in the android.R.attr#installLocation attribute.
Requires API level 21 (Android 5.0, Lollipop)

Value: 2

REQUESTED_PERMISSION_GRANTED

added in API level 16
static val REQUESTED_PERMISSION_GRANTED: Int

Flag for #requestedPermissionsFlags: the requested permission is currently granted to the application.
Requires API level 16 (Android 4.1, Jelly Bean)

Value: 2

Public constructors

<init>

PackageInfo()

Public methods

writeToParcel

open fun writeToParcel(dest: Parcel!, parcelableFlags: Int): Unit

setLongVersionCode

added in API level 28
open fun setLongVersionCode(longVersionCode: Long): Unit

Set the full version code in this PackageInfo, updating #versionCode with the lower bits.
Requires API level 28 (Android 8.+, P)

getLongVersionCode

added in API level 28
open fun getLongVersionCode(): Long

Return versionCode and versionCodeMajor combined together as a single long value. The versionCodeMajor is placed in the upper 32 bits.
Requires API level 28 (Android 8.+, P)

toString

open fun toString(): String

describeContents

open fun describeContents(): Int

Properties

activities

var activities: Array<ActivityInfo!>!

Array of all &lt;activity&gt; tags included under <application>, or null if there were none. This is only filled in if the flag PackageManager#GET_ACTIVITIES was set.

applicationInfo

var applicationInfo: ApplicationInfo!

Information collected from the <application> tag, or null if there was none.

baseRevisionCode

added in API level 22
var baseRevisionCode: Int

The revision number of the base APK for this package, as specified by the <manifest> tag's revisionCode attribute.
Requires API level 22 (Android 5.1, Lollipop)

configPreferences

added in API level 3
var configPreferences: Array<ConfigurationInfo!>!

Application specified preferred configuration &lt;uses-configuration&gt; tags included under <manifest>, or null if there were none. This is only filled in if the flag PackageManager#GET_CONFIGURATIONS was set.
Requires API level 3 (Android 1.5, Cupcake)

featureGroups

added in API level 21
var featureGroups: Array<FeatureGroupInfo!>!

Groups of features that this application has requested. Each group contains a set of features that are required. A device must match the features listed in #reqFeatures and one or more FeatureGroups in order to have satisfied the feature requirement.
Requires API level 21 (Android 5.0, Lollipop)

firstInstallTime

added in API level 9
var firstInstallTime: Long

The time at which the app was first installed. Units are as per System#currentTimeMillis().
Requires API level 9 (Android 2.3, Gingerbread)

gids

var gids: IntArray!

All kernel group-IDs that have been assigned to this package. This is only filled in if the flag PackageManager#GET_GIDS was set.

installLocation

added in API level 21
var installLocation: Int

The install location requested by the package. From the android.R.attr#installLocation attribute, one of #INSTALL_LOCATION_AUTO, #INSTALL_LOCATION_INTERNAL_ONLY, #INSTALL_LOCATION_PREFER_EXTERNAL
Requires API level 21 (Android 5.0, Lollipop)

instrumentation

var instrumentation: Array<InstrumentationInfo!>!

Array of all &lt;instrumentation&gt; tags included under <manifest>, or null if there were none. This is only filled in if the flag PackageManager#GET_INSTRUMENTATION was set.

lastUpdateTime

added in API level 9
var lastUpdateTime: Long

The time at which the app was last updated. Units are as per System#currentTimeMillis().
Requires API level 9 (Android 2.3, Gingerbread)

packageName

var packageName: String!

The name of this package. From the <manifest> tag's "name" attribute.

permissions

var permissions: Array<PermissionInfo!>!

Array of all &lt;permission&gt; tags included under <manifest>, or null if there were none. This is only filled in if the flag PackageManager#GET_PERMISSIONS was set.

providers

var providers: Array<ProviderInfo!>!

Array of all &lt;provider&gt; tags included under <application>, or null if there were none. This is only filled in if the flag PackageManager#GET_PROVIDERS was set.

receivers

var receivers: Array<ActivityInfo!>!

Array of all &lt;receiver&gt; tags included under <application>, or null if there were none. This is only filled in if the flag PackageManager#GET_RECEIVERS was set.

reqFeatures

added in API level 5
var reqFeatures: Array<FeatureInfo!>!

Features that this application has requested.
Requires API level 5 (Android 2.0, Eclair)

requestedPermissions

var requestedPermissions: Array<String!>!

Array of all &lt;uses-permission&gt; tags included under <manifest>, or null if there were none. This is only filled in if the flag PackageManager#GET_PERMISSIONS was set. This list includes all permissions requested, even those that were not granted or known by the system at install time.

requestedPermissionsFlags

added in API level 16
var requestedPermissionsFlags: IntArray!

Array of flags of all &lt;uses-permission&gt; tags included under <manifest>, or null if there were none. This is only filled in if the flag PackageManager#GET_PERMISSIONS was set. Each value matches the corresponding entry in #requestedPermissions, and will have the flag #REQUESTED_PERMISSION_GRANTED set as appropriate.
Requires API level 16 (Android 4.1, Jelly Bean)

services

var services: Array<ServiceInfo!>!

Array of all &lt;service&gt; tags included under <application>, or null if there were none. This is only filled in if the flag PackageManager#GET_SERVICES was set.

sharedUserId

added in API level 3
var sharedUserId: String!

The shared user ID name of this package, as specified by the <manifest> tag's sharedUserId attribute.
Requires API level 3 (Android 1.5, Cupcake)

sharedUserLabel

added in API level 3
var sharedUserLabel: Int

The shared user ID label of this package, as specified by the <manifest> tag's sharedUserLabel attribute.
Requires API level 3 (Android 1.5, Cupcake)

signatures

var signatures: Array<Signature!>!

Array of all signatures read from the package file. This is only filled in if the flag PackageManager#GET_SIGNATURES was set. A package must be signed with at least one certificate which is at position zero. The package can be signed with additional certificates which appear as subsequent entries. Note: Signature ordering is not guaranteed to be stable which means that a package signed with certificates A and B is equivalent to being signed with certificates B and A. This means that in case multiple signatures are reported you cannot assume the one at the first position to be the same across updates. Deprecated This has been replaced by the PackageInfo#signingInfo field, which takes into account signing certificate rotation. For backwards compatibility in the event of signing certificate rotation, this will return the oldest reported signing certificate, so that an application will appear to callers as though no rotation occurred.

signingInfo

added in API level 28
var signingInfo: SigningInfo!

Signing information read from the package file, potentially including past signing certificates no longer used after signing certificate rotation. This is only filled in if the flag PackageManager#GET_SIGNING_CERTIFICATES was set. Use this field instead of the deprecated signatures field. See SigningInfo for more information on its contents.
Requires API level 28 (Android 8.+, P)

splitNames

added in API level 21
var splitNames: Array<String!>!

The names of any installed split APKs for this package.
Requires API level 21 (Android 5.0, Lollipop)

splitRevisionCodes

added in API level 22
var splitRevisionCodes: IntArray!

The revision number of any split APKs for this package, as specified by the <manifest> tag's revisionCode attribute. Indexes are a 1:1 mapping against #splitNames.
Requires API level 22 (Android 5.1, Lollipop)

versionCode

var versionCode: Int

versionName

var versionName: String!

The version name of this package, as specified by the <manifest> tag's versionName attribute.

CREATOR

static val CREATOR: Parcelable.Creator<PackageInfo!>!