# PackageInstaller

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/content/pm/PackageInstaller#nestedclasses)\|[Constants](https://developer.android.com/reference/android/content/pm/PackageInstaller#constants)\|[Methods](https://developer.android.com/reference/android/content/pm/PackageInstaller#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/content/pm/PackageInstaller#inhmethods)  

# PackageInstaller

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/content/pm/PackageInstaller "View this page in Kotlin")\|Java

`
public


class
PackageInstaller
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.pm.PackageInstaller |

<br />

*** ** * ** ***

Offers the ability to install, upgrade, and remove applications on the device. This includes support for apps packaged either as a single "monolithic" APK, or apps packaged as multiple "split" APKs.

An app is delivered for installation through a[PackageInstaller.Session](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session), which any app can create. Once the session is created, the installer can stream one or more APKs into place until it decides to either commit or destroy the session. Committing may require user intervention to complete the installation, unless the caller falls into one of the following categories, in which case the installation will complete automatically.

- the device owner
- the affiliated profile owner

Sessions can install brand new apps, upgrade existing apps, or add new splits into an existing app.

Apps packaged as multiple split APKs always consist of a single "base" APK (with a`null`split name) and zero or more "split" APKs (with unique split names). Any subset of these APKs can be installed together, as long as the following constraints are met:

- All APKs must have the exact same package name, version code, and signing certificates.
- All APKs must have unique split names.
- All installations must contain a single base APK.

The ApiDemos project contains examples of using this API:`ApiDemos/src/com/example/android/apis/content/InstallApk*.java`.

## Summary

|                                                                                                                                                                                                                                                                                                                                        ### Nested classes                                                                                                                                                                                                                                                                                                                                        ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [PackageInstaller.InstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints) A class to encapsulate constraints for installation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` class` | [PackageInstaller.InstallConstraintsResult](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraintsResult) The callback result of[PackageInstaller.checkInstallConstraints(java.util.List, android.content.pm.PackageInstaller.InstallConstraints, java.util.concurrent.Executor, java.util.function.Consumer)](https://developer.android.com/reference/android/content/pm/PackageInstaller#checkInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.content.pm.PackageInstaller.InstallConstraintsResult>)). |
| ` class` | [PackageInstaller.PreapprovalDetails](https://developer.android.com/reference/android/content/pm/PackageInstaller.PreapprovalDetails) Details for requesting the pre-commit install approval.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` class` | [PackageInstaller.Session](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session) An installation that is being actively staged.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` class` | [PackageInstaller.SessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback) Events for observing session lifecycle.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` class` | [PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo) Details for an active install session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` class` | [PackageInstaller.SessionParams](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams) Parameters for creating a new[PackageInstaller.Session](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session).                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` class` | [PackageInstaller.UnarchivalState](https://developer.android.com/reference/android/content/pm/PackageInstaller.UnarchivalState) Used to communicate the unarchival state in[PackageInstaller.reportUnarchivalState(UnarchivalState)](https://developer.android.com/reference/android/content/pm/PackageInstaller#reportUnarchivalState(android.content.pm.PackageInstaller.UnarchivalState)).                                                                                                                                                                                                                                                                                          |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ### Constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ||
|--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_SESSION_COMMITTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#ACTION_SESSION_COMMITTED) Broadcast Action: Explicit broadcast sent to the last known default launcher when a session for a new install is committed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_SESSION_DETAILS](https://developer.android.com/reference/android/content/pm/PackageInstaller#ACTION_SESSION_DETAILS) Activity Action: Show details about a particular install session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_SESSION_UPDATED](https://developer.android.com/reference/android/content/pm/PackageInstaller#ACTION_SESSION_UPDATED) Broadcast Action: Send information about a staged install session when its state is updated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `int`                                                              | [DEVELOPER_VERIFICATION_FAILED_REASON_DEVELOPER_BLOCKED](https://developer.android.com/reference/android/content/pm/PackageInstaller#DEVELOPER_VERIFICATION_FAILED_REASON_DEVELOPER_BLOCKED) Developer verification failed because the developer cannot be verified, as reported by the verifier via[ERROR(DeveloperVerificationSession.reportVerificationComplete(DeveloperVerificationStatus)/android.content.pm.verify.developer.DeveloperVerificationSession#reportVerificationComplete(android.content.pm.verify.developer.DeveloperVerificationStatus) DeveloperVerificationSession.reportVerificationComplete(DeveloperVerificationStatus))](https://developer.android.com/)or[ERROR(DeveloperVerificationSession.reportVerificationComplete( DeveloperVerificationStatus, PersistableBundle)/android.content.pm.verify.developer.DeveloperVerificationSession#reportVerificationComplete(android.content.pm.verify.developer.DeveloperVerificationStatus,android.os.PersistableBundle) DeveloperVerificationSession.reportVerificationComplete( DeveloperVerificationStatus, PersistableBundle))](https://developer.android.com/) |
| `int`                                                              | [DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE](https://developer.android.com/reference/android/content/pm/PackageInstaller#DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE) Developer verification failed because the network is unavailable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `int`                                                              | [DEVELOPER_VERIFICATION_FAILED_REASON_UNKNOWN](https://developer.android.com/reference/android/content/pm/PackageInstaller#DEVELOPER_VERIFICATION_FAILED_REASON_UNKNOWN) Developer verification failed because of unknown reasons, such as when the verifier times out or cannot be connected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_DEVELOPER_VERIFICATION_EXTENSION_RESPONSE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_DEVELOPER_VERIFICATION_EXTENSION_RESPONSE) An extra containing the response provided by the developer verifier to any extension params provided by the installer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_DEVELOPER_VERIFICATION_FAILURE_REASON](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_DEVELOPER_VERIFICATION_FAILURE_REASON) When an installation fails because the developer verification was incomplete or blocked, this extra provides a code that explains the reason, such as[DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE](https://developer.android.com/reference/android/content/pm/PackageInstaller#DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_DEVELOPER_VERIFICATION_LITE_PERFORMED](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_DEVELOPER_VERIFICATION_LITE_PERFORMED) An extra containing a boolean indicating whether the lite version of the developer verification was performed on the app to be installed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_INSTALL_CONSTRAINTS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_INSTALL_CONSTRAINTS) The[InstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints)object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_INSTALL_CONSTRAINTS_RESULT](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_INSTALL_CONSTRAINTS_RESULT) The[InstallConstraintsResult](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraintsResult)object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_OTHER_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_OTHER_PACKAGE_NAME) Another package name relevant to a status.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_PACKAGE_NAME) Package name that an operation is working with.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_PRE_APPROVAL](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_PRE_APPROVAL) Indicate if the status is for a pre-approval request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_SESSION](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_SESSION) [SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)that an operation is working with.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_SESSION_ID](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_SESSION_ID) An integer session ID that an operation is working with.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS) Current status of an operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE) Detailed string representation of the status, including raw details that are useful for debugging.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_STORAGE_PATH](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STORAGE_PATH) Storage path relevant to a status.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_UNARCHIVE_ALL_USERS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_UNARCHIVE_ALL_USERS) If true, the requestor of the unarchival has specified that the app should be unarchived for all users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_UNARCHIVE_ID](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_UNARCHIVE_ID) Extra field for the unarchive ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_UNARCHIVE_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_UNARCHIVE_PACKAGE_NAME) Extra field for the package name of a package that is requested to be unarchived.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_UNARCHIVE_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_UNARCHIVE_STATUS) Current status of an unarchive operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `int`                                                              | [PACKAGE_SOURCE_DOWNLOADED_FILE](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_DOWNLOADED_FILE) Code indicating that the package being installed comes from a file that was downloaded to the device by the user.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `int`                                                              | [PACKAGE_SOURCE_LOCAL_FILE](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_LOCAL_FILE) Code indicating that the package being installed comes from a local file on the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `int`                                                              | [PACKAGE_SOURCE_OTHER](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_OTHER) Code indicating that the package being installed is from a source not reflected by any other package source constant.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `int`                                                              | [PACKAGE_SOURCE_STORE](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_STORE) Code indicating that the package being installed is from a store.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `int`                                                              | [PACKAGE_SOURCE_UNSPECIFIED](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_UNSPECIFIED) The installer did not call[PackageInstaller.SessionParams.setPackageSource(int)](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams#setPackageSource(int))to specify the package source.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `int`                                                              | [STATUS_FAILURE](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE) The operation failed in a generic way.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `int`                                                              | [STATUS_FAILURE_ABORTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_ABORTED) The operation failed because it was actively aborted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `int`                                                              | [STATUS_FAILURE_BLOCKED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_BLOCKED) The operation failed because it was blocked.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `int`                                                              | [STATUS_FAILURE_CONFLICT](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_CONFLICT) The operation failed because it conflicts (or is inconsistent with) with another package already installed on the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `int`                                                              | [STATUS_FAILURE_INCOMPATIBLE](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_INCOMPATIBLE) The operation failed because it is fundamentally incompatible with this device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `int`                                                              | [STATUS_FAILURE_INVALID](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_INVALID) The operation failed because one or more of the APKs was invalid.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `int`                                                              | [STATUS_FAILURE_STORAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_STORAGE) The operation failed because of storage issues.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `int`                                                              | [STATUS_FAILURE_TIMEOUT](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_TIMEOUT) The operation failed because it didn't complete within the specified timeout.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `int`                                                              | [STATUS_PENDING_USER_ACTION](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_PENDING_USER_ACTION) User action is currently required to proceed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `int`                                                              | [STATUS_SUCCESS](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_SUCCESS) The operation succeeded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `int`                                                              | [UNARCHIVAL_ERROR_INSTALLER_DISABLED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSTALLER_DISABLED) The installer responsible for the unarchival is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `int`                                                              | [UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED) The installer responsible for the unarchival has been uninstalled The system will return this status if appropriate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `int`                                                              | [UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE) Not enough storage to unarchive the application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `int`                                                              | [UNARCHIVAL_ERROR_NO_CONNECTIVITY](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_NO_CONNECTIVITY) The device is not connected to the internet                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `int`                                                              | [UNARCHIVAL_ERROR_USER_ACTION_NEEDED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_USER_ACTION_NEEDED) The user needs to interact with the installer to enable the installation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `int`                                                              | [UNARCHIVAL_GENERIC_ERROR](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_GENERIC_ERROR) Generic error: The app cannot be unarchived.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `int`                                                              | [UNARCHIVAL_OK](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_OK) The unarchival is possible and will commence.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                                                                                                        | ` `[abandonSession](https://developer.android.com/reference/android/content/pm/PackageInstaller#abandonSession(int))`(int sessionId) ` Completely abandon the given session, destroying all staged data and rendering it invalid.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                                                                                                                        | ` `[checkInstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller#checkInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.content.pm.PackageInstaller.InstallConstraintsResult>))`(`[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`> packageNames, `[PackageInstaller.InstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints)` constraints, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor, `[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<`[PackageInstaller.InstallConstraintsResult](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraintsResult)`> callback) ` Check if install constraints are satisfied for the given packages.                                                                                                                                                                                                                |
| ` void`                                                                                                                                                                                        | ` `[commitSessionAfterInstallConstraintsAreMet](https://developer.android.com/reference/android/content/pm/PackageInstaller#commitSessionAfterInstallConstraintsAreMet(int,%20android.content.IntentSender,%20android.content.pm.PackageInstaller.InstallConstraints,%20long))`(int sessionId, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver, `[PackageInstaller.InstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints)` constraints, long timeoutMillis) ` Commit the session when all constraints are satisfied.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` int`                                                                                                                                                                                         | ` `[createSession](https://developer.android.com/reference/android/content/pm/PackageInstaller#createSession(android.content.pm.PackageInstaller.SessionParams))`(`[PackageInstaller.SessionParams](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams)` params) ` Create a new session using the given parameters, returning a unique ID that represents the session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` `[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)                                                                     | ` `[getActiveStagedSession](https://developer.android.com/reference/android/content/pm/PackageInstaller#getActiveStagedSession())`() ` *This method was deprecated in API level 30. Use[getActiveStagedSessions()](https://developer.android.com/reference/android/content/pm/PackageInstaller#getActiveStagedSessions())as there can be more than one active staged session*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | ` `[getActiveStagedSessions](https://developer.android.com/reference/android/content/pm/PackageInstaller#getActiveStagedSessions())`() ` Returns list of active staged sessions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | ` `[getAllSessions](https://developer.android.com/reference/android/content/pm/PackageInstaller#getAllSessions())`() ` Return list of all known install sessions, regardless of the installer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` final `[ComponentName](https://developer.android.com/reference/android/content/ComponentName)                                                                                                | ` `[getDeveloperVerificationServiceProvider](https://developer.android.com/reference/android/content/pm/PackageInstaller#getDeveloperVerificationServiceProvider())`() ` Return the component name of the developer verification service provider, for the purpose of interacting with the specific verifier in relation to extension parameters and response structure.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | ` `[getMySessions](https://developer.android.com/reference/android/content/pm/PackageInstaller#getMySessions())`() ` Return list of all known install sessions owned by the calling app.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` `[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)                                                                     | ` `[getSessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller#getSessionInfo(int))`(int sessionId) ` Return details for a specific session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | ` `[getStagedSessions](https://developer.android.com/reference/android/content/pm/PackageInstaller#getStagedSessions())`() ` Return list of all staged install sessions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                                                                                                        | ` `[installExistingPackage](https://developer.android.com/reference/android/content/pm/PackageInstaller#installExistingPackage(java.lang.String,%20int,%20android.content.IntentSender))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName, int installReason, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Install the given package, which already exists on the device, for the user for which this installer was created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                                                                                                        | ` `[installPackageArchived](https://developer.android.com/reference/android/content/pm/PackageInstaller#installPackageArchived(android.content.pm.ArchivedPackageInfo,%20android.content.pm.PackageInstaller.SessionParams,%20android.content.IntentSender))`(`[ArchivedPackageInfo](https://developer.android.com/reference/android/content/pm/ArchivedPackageInfo)` archivedPackageInfo, `[PackageInstaller.SessionParams](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams)` sessionParams, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Install package in an archived state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` `[PackageInstaller.Session](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session)                                                                             | ` `[openSession](https://developer.android.com/reference/android/content/pm/PackageInstaller#openSession(int))`(int sessionId) ` Open an existing session to actively perform work.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` void`                                                                                                                                                                                        | ` `[registerSessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller#registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback,%20android.os.Handler))`(`[PackageInstaller.SessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback)` callback, `[Handler](https://developer.android.com/reference/android/os/Handler)` handler) ` Register to watch for session lifecycle events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                                                                        | ` `[registerSessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller#registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback))`(`[PackageInstaller.SessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback)` callback) ` Register to watch for session lifecycle events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                                                                                                        | ` `[reportUnarchivalState](https://developer.android.com/reference/android/content/pm/PackageInstaller#reportUnarchivalState(android.content.pm.PackageInstaller.UnarchivalState))`(`[PackageInstaller.UnarchivalState](https://developer.android.com/reference/android/content/pm/PackageInstaller.UnarchivalState)` unarchivalState) ` Reports the state of an unarchival to the system.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                                                                                                        | ` `[reportUnarchivalStatus](https://developer.android.com/reference/android/content/pm/PackageInstaller#reportUnarchivalStatus(int,%20int,%20long,%20android.app.PendingIntent))`(int unarchiveId, int status, long requiredStorageBytes, `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent)` userActionIntent) ` Reports the status of an unarchival to the system.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                                                                                                        | ` `[requestArchive](https://developer.android.com/reference/android/content/pm/PackageInstaller#requestArchive(java.lang.String,%20android.content.IntentSender))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Requests to archive a package which is currently installed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                                                                                                        | ` `[requestUnarchive](https://developer.android.com/reference/android/content/pm/PackageInstaller#requestUnarchive(java.lang.String,%20android.content.IntentSender))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Requests to unarchive a currently archived package.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                                                                                                                        | ` `[uninstall](https://developer.android.com/reference/android/content/pm/PackageInstaller#uninstall(java.lang.String,%20android.content.IntentSender))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Uninstall the given package, removing it completely from the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                                                                                                        | ` `[uninstall](https://developer.android.com/reference/android/content/pm/PackageInstaller#uninstall(android.content.pm.VersionedPackage,%20int,%20android.content.IntentSender))`(`[VersionedPackage](https://developer.android.com/reference/android/content/pm/VersionedPackage)` versionedPackage, int flags, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Uninstall the given package with a specific version code, removing it completely from the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                                                                        | ` `[uninstall](https://developer.android.com/reference/android/content/pm/PackageInstaller#uninstall(android.content.pm.VersionedPackage,%20android.content.IntentSender))`(`[VersionedPackage](https://developer.android.com/reference/android/content/pm/VersionedPackage)` versionedPackage, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Uninstall the given package with a specific version code, removing it completely from the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                                                                                                        | ` `[uninstallExistingPackage](https://developer.android.com/reference/android/content/pm/PackageInstaller#uninstallExistingPackage(java.lang.String,%20android.content.IntentSender))`(`[String](https://developer.android.com/reference/java/lang/String)` packageName, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` statusReceiver) ` Uninstall the given package for the user for which this installer was created if the package will still exist for other users on the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`                                                                                                                                                                                        | ` `[unregisterSessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller#unregisterSessionCallback(android.content.pm.PackageInstaller.SessionCallback))`(`[PackageInstaller.SessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback)` callback) ` Unregister a previously registered callback.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                                                                                                        | ` `[updateSessionAppIcon](https://developer.android.com/reference/android/content/pm/PackageInstaller#updateSessionAppIcon(int,%20android.graphics.Bitmap))`(int sessionId, `[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap)` appIcon) ` Update the icon representing the app being installed in a specific session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`                                                                                                                                                                                        | ` `[updateSessionAppLabel](https://developer.android.com/reference/android/content/pm/PackageInstaller#updateSessionAppLabel(int,%20java.lang.CharSequence))`(int sessionId, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` appLabel) ` Update the label representing the app being installed in a specific session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                                                                                                        | ` `[waitForInstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller#waitForInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20android.content.IntentSender,%20long))`(`[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`> packageNames, `[PackageInstaller.InstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints)` constraints, `[IntentSender](https://developer.android.com/reference/android/content/IntentSender)` callback, long timeoutMillis) ` Similar to[checkInstallConstraints(java.util.List, android.content.pm.PackageInstaller.InstallConstraints, java.util.concurrent.Executor, java.util.function.Consumer)](https://developer.android.com/reference/android/content/pm/PackageInstaller#checkInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.content.pm.PackageInstaller.InstallConstraintsResult>)), but the callback is invoked only when the constraints are satisfied or after timeout. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### ACTION_SESSION_COMMITTED

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String ACTION_SESSION_COMMITTED
```

Broadcast Action: Explicit broadcast sent to the last known default launcher when a session for a new install is committed. For managed profile, this is sent to the default launcher of the primary profile. For user-profiles that have items restricted on home screen, this broadcast is sent to the default launcher of the primary profile, only if it has either[ERROR(/Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL)](https://developer.android.com/)or[ERROR(/Manifest.permission.ACCESS_HIDDEN_PROFILES)](https://developer.android.com/)permission.

The associated session is defined in[EXTRA_SESSION](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_SESSION)and the user for which this session was created in[Intent.EXTRA_USER](https://developer.android.com/reference/android/content/Intent#EXTRA_USER).

<br />

Constant Value: "android.content.pm.action.SESSION_COMMITTED"  

### ACTION_SESSION_DETAILS

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String ACTION_SESSION_DETAILS
```

Activity Action: Show details about a particular install session. This may surface actions such as pause, resume, or cancel.

This should always be scoped to the installer package that owns the session. Clients should use[SessionInfo.createDetailsIntent()](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo#createDetailsIntent())to build this intent correctly.

In some cases, a matching Activity may not exist, so ensure you safeguard against this.

The session to show details for is defined in[EXTRA_SESSION_ID](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_SESSION_ID).

<br />

Constant Value: "android.content.pm.action.SESSION_DETAILS"  

### ACTION_SESSION_UPDATED

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String ACTION_SESSION_UPDATED
```

Broadcast Action: Send information about a staged install session when its state is updated.

The associated session information is defined in[EXTRA_SESSION](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_SESSION).

<br />

Constant Value: "android.content.pm.action.SESSION_UPDATED"  

### DEVELOPER_VERIFICATION_FAILED_REASON_DEVELOPER_BLOCKED

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static final int DEVELOPER_VERIFICATION_FAILED_REASON_DEVELOPER_BLOCKED
```

Developer verification failed because the developer cannot be verified, as reported by the verifier via[ERROR(DeveloperVerificationSession.reportVerificationComplete(DeveloperVerificationStatus)/android.content.pm.verify.developer.DeveloperVerificationSession#reportVerificationComplete(android.content.pm.verify.developer.DeveloperVerificationStatus) DeveloperVerificationSession.reportVerificationComplete(DeveloperVerificationStatus))](https://developer.android.com/)or[ERROR(DeveloperVerificationSession.reportVerificationComplete(
DeveloperVerificationStatus, PersistableBundle)/android.content.pm.verify.developer.DeveloperVerificationSession#reportVerificationComplete(android.content.pm.verify.developer.DeveloperVerificationStatus,android.os.PersistableBundle) DeveloperVerificationSession.reportVerificationComplete(
DeveloperVerificationStatus, PersistableBundle))](https://developer.android.com/)

<br />

Constant Value: 2 (0x00000002)  

### DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static final int DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE
```

Developer verification failed because the network is unavailable. This corresponds to the status of[ERROR(DeveloperVerificationSession.DEVELOPER_VERIFICATION_INCOMPLETE_NETWORK_UNAVAILABLE/android.content.pm.verify.developer.DeveloperVerificationSession#DEVELOPER_VERIFICATION_INCOMPLETE_NETWORK_UNAVAILABLE DeveloperVerificationSession.DEVELOPER_VERIFICATION_INCOMPLETE_NETWORK_UNAVAILABLE)](https://developer.android.com/)reported by the verifier via[ERROR(DeveloperVerificationSession.reportVerificationIncomplete(int)/android.content.pm.verify.developer.DeveloperVerificationSession#reportVerificationIncomplete(int) DeveloperVerificationSession.reportVerificationIncomplete(int))](https://developer.android.com/).

<br />

Constant Value: 1 (0x00000001)  

### DEVELOPER_VERIFICATION_FAILED_REASON_UNKNOWN

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static final int DEVELOPER_VERIFICATION_FAILED_REASON_UNKNOWN
```

Developer verification failed because of unknown reasons, such as when the verifier times out or cannot be connected. It can also corresponds to the status of[ERROR(DeveloperVerificationSession.DEVELOPER_VERIFICATION_INCOMPLETE_UNKNOWN/android.content.pm.verify.developer.DeveloperVerificationSession#DEVELOPER_VERIFICATION_INCOMPLETE_UNKNOWN DeveloperVerificationSession.DEVELOPER_VERIFICATION_INCOMPLETE_UNKNOWN)](https://developer.android.com/)reported by the verifier via[ERROR(DeveloperVerificationSession.reportVerificationIncomplete(int)/android.content.pm.verify.developer.DeveloperVerificationSession#reportVerificationIncomplete(int) DeveloperVerificationSession.reportVerificationIncomplete(int))](https://developer.android.com/).

<br />

Constant Value: 0 (0x00000000)  

### EXTRA_DEVELOPER_VERIFICATION_EXTENSION_RESPONSE

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static final String EXTRA_DEVELOPER_VERIFICATION_EXTENSION_RESPONSE
```

An extra containing the response provided by the developer verifier to any extension params provided by the installer. It will be of type[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle).

<br />

Constant Value: "android.content.pm.extra.DEVELOPER_VERIFICATION_EXTENSION_RESPONSE"  

### EXTRA_DEVELOPER_VERIFICATION_FAILURE_REASON

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static final String EXTRA_DEVELOPER_VERIFICATION_FAILURE_REASON
```

When an installation fails because the developer verification was incomplete or blocked, this extra provides a code that explains the reason, such as[DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE](https://developer.android.com/reference/android/content/pm/PackageInstaller#DEVELOPER_VERIFICATION_FAILED_REASON_NETWORK_UNAVAILABLE). It is included in the installation result returned via the[IntentSender](https://developer.android.com/reference/android/content/IntentSender)in[Session.commit(IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender)). However, along with this reason code, installers can receive different status codes from[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS)depending on their target SDK and permission status:

- Installers without the[INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)permission but with the[REQUEST_INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_INSTALL_PACKAGES)permission and targeting[API 36](https://developer.android.com/reference/android/os/Build.VERSION_CODES#BAKLAVA)or less will first receive the[STATUS_PENDING_USER_ACTION](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_PENDING_USER_ACTION)status code without this reason code. They will be forced through the user action flow to allow the OS to inform the user of such verification context before continuing to fail the install. If the user has the option to bypass the verification result and chooses to do so, the installation will proceed. Otherwise, the installer will receive the[STATUS_FAILURE_ABORTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_ABORTED)status code along with this reason code that explains why the verification had failed.
- Installers with the[INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)permission and targeting[API 36](https://developer.android.com/reference/android/os/Build.VERSION_CODES#BAKLAVA)or less will directly receive the[STATUS_FAILURE_ABORTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_ABORTED)status code. This is because they are not expected to have the capability of handling the[STATUS_PENDING_USER_ACTION](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_PENDING_USER_ACTION)flow, so the installation will directly fail. This reason code will be supplied to them for providing additional information.
- For all installers targeting higher than[API 36](https://developer.android.com/reference/android/os/Build.VERSION_CODES#BAKLAVA)
  - For situations that require user input, such as when the developer verification policy allows the user to bypass a verification failure caused by network issues, the installer will receive a[STATUS_PENDING_USER_ACTION](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_PENDING_USER_ACTION)status code without this reason code. The installer will be forced through the user action flow to allow the OS to inform the user of such verification context before continuing to fail the installation. If the user has the option to bypass the verification result and chooses to do so, the installation will proceed. Otherwise, the install will receive the[STATUS_FAILURE_ABORTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_ABORTED)status code along with this reason code that explains why the verification had failed.
  - For all other situations, the installer will receive a[STATUS_FAILURE_ABORTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_ABORTED)status code along with this reason code, so the installers can explain the failure to the user accordingly. An[Intent.EXTRA_INTENT](https://developer.android.com/reference/android/content/Intent#EXTRA_INTENT)will also be populated with an intent that can provide additional context where appropriate, should the installer prefer to defer to the OS to explain the failure to the user.

<br />

<br />

Constant Value: "android.content.pm.extra.DEVELOPER_VERIFICATION_FAILURE_REASON"  

### EXTRA_DEVELOPER_VERIFICATION_LITE_PERFORMED

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public static final String EXTRA_DEVELOPER_VERIFICATION_LITE_PERFORMED
```

An extra containing a boolean indicating whether the lite version of the developer verification was performed on the app to be installed. It is included in the installation result returned via the[IntentSender](https://developer.android.com/reference/android/content/IntentSender)in[Session.commit(IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender))when the installation failed.

<br />

Constant Value: "android.content.pm.extra.DEVELOPER_VERIFICATION_LITE_PERFORMED"  

### EXTRA_INSTALL_CONSTRAINTS

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_INSTALL_CONSTRAINTS
```

The[InstallConstraints](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints)object.

<br />

**See also:**

- [Intent.getParcelableExtra(String, Class)](https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String,%20java.lang.Class<T>))
- [waitForInstallConstraints(List, InstallConstraints, IntentSender, long)](https://developer.android.com/reference/android/content/pm/PackageInstaller#waitForInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20android.content.IntentSender,%20long))

Constant Value: "android.content.pm.extra.INSTALL_CONSTRAINTS"  

### EXTRA_INSTALL_CONSTRAINTS_RESULT

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_INSTALL_CONSTRAINTS_RESULT
```

The[InstallConstraintsResult](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraintsResult)object.

<br />

**See also:**

- [Intent.getParcelableExtra(String, Class)](https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String,%20java.lang.Class<T>))
- [waitForInstallConstraints(List, InstallConstraints, IntentSender, long)](https://developer.android.com/reference/android/content/pm/PackageInstaller#waitForInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20android.content.IntentSender,%20long))

Constant Value: "android.content.pm.extra.INSTALL_CONSTRAINTS_RESULT"  

### EXTRA_OTHER_PACKAGE_NAME

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_OTHER_PACKAGE_NAME
```

Another package name relevant to a status. This is typically the package responsible for causing an operation failure.

<br />

**See also:**

- [Intent.getStringExtra(String)](https://developer.android.com/reference/android/content/Intent#getStringExtra(java.lang.String))

Constant Value: "android.content.pm.extra.OTHER_PACKAGE_NAME"  

### EXTRA_PACKAGE_NAME

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_PACKAGE_NAME
```

Package name that an operation is working with.

<br />

**See also:**

- [Intent.getStringExtra(String)](https://developer.android.com/reference/android/content/Intent#getStringExtra(java.lang.String))

Constant Value: "android.content.pm.extra.PACKAGE_NAME"  

### EXTRA_PRE_APPROVAL

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_PRE_APPROVAL
```

Indicate if the status is for a pre-approval request. If callers use the same[IntentSender](https://developer.android.com/reference/android/content/IntentSender)for both[Session.requestUserPreapproval(PreapprovalDetails, IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#requestUserPreapproval(android.content.pm.PackageInstaller.PreapprovalDetails,%20android.content.IntentSender))and[Session.commit(IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender)), they can use this to differentiate between them.

<br />

**See also:**

- [Intent.getBooleanExtra(String, boolean)](https://developer.android.com/reference/android/content/Intent#getBooleanExtra(java.lang.String,%20boolean))

Constant Value: "android.content.pm.extra.PRE_APPROVAL"  

### EXTRA_SESSION

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_SESSION
```

[SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)that an operation is working with.

<br />

**See also:**

- [Intent.getParcelableExtra(String)](https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String))

Constant Value: "android.content.pm.extra.SESSION"  

### EXTRA_SESSION_ID

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_SESSION_ID
```

An integer session ID that an operation is working with.

<br />

**See also:**

- [Intent.getIntExtra(String, int)](https://developer.android.com/reference/android/content/Intent#getIntExtra(java.lang.String,%20int))

Constant Value: "android.content.pm.extra.SESSION_ID"  

### EXTRA_STATUS

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_STATUS
```

Current status of an operation. Will be one of[STATUS_PENDING_USER_ACTION](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_PENDING_USER_ACTION),[STATUS_SUCCESS](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_SUCCESS),[STATUS_FAILURE](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE),[STATUS_FAILURE_ABORTED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_ABORTED),[STATUS_FAILURE_BLOCKED](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_BLOCKED),[STATUS_FAILURE_CONFLICT](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_CONFLICT),[STATUS_FAILURE_INCOMPATIBLE](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_INCOMPATIBLE),[STATUS_FAILURE_INVALID](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_INVALID),[STATUS_FAILURE_STORAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_STORAGE), or[STATUS_FAILURE_TIMEOUT](https://developer.android.com/reference/android/content/pm/PackageInstaller#STATUS_FAILURE_TIMEOUT).

More information about a status may be available through additional extras; see the individual status documentation for details.

<br />

**See also:**

- [Intent.getIntExtra(String, int)](https://developer.android.com/reference/android/content/Intent#getIntExtra(java.lang.String,%20int))

Constant Value: "android.content.pm.extra.STATUS"  

### EXTRA_STATUS_MESSAGE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_STATUS_MESSAGE
```

Detailed string representation of the status, including raw details that are useful for debugging.

<br />

**See also:**

- [Intent.getStringExtra(String)](https://developer.android.com/reference/android/content/Intent#getStringExtra(java.lang.String))

Constant Value: "android.content.pm.extra.STATUS_MESSAGE"  

### EXTRA_STORAGE_PATH

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_STORAGE_PATH
```

Storage path relevant to a status.

<br />

**See also:**

- [Intent.getStringExtra(String)](https://developer.android.com/reference/android/content/Intent#getStringExtra(java.lang.String))

Constant Value: "android.content.pm.extra.STORAGE_PATH"  

### EXTRA_UNARCHIVE_ALL_USERS

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_UNARCHIVE_ALL_USERS
```

If true, the requestor of the unarchival has specified that the app should be unarchived for all users. Sent as part of the[Intent.ACTION_UNARCHIVE_PACKAGE](https://developer.android.com/reference/android/content/Intent#ACTION_UNARCHIVE_PACKAGE)intent.

<br />

Constant Value: "android.content.pm.extra.UNARCHIVE_ALL_USERS"  

### EXTRA_UNARCHIVE_ID

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_UNARCHIVE_ID
```

Extra field for the unarchive ID. Sent as part of the[Intent.ACTION_UNARCHIVE_PACKAGE](https://developer.android.com/reference/android/content/Intent#ACTION_UNARCHIVE_PACKAGE)intent.

<br />

**See also:**

- [PackageInstaller.SessionParams.setUnarchiveId(int)](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams#setUnarchiveId(int))

Constant Value: "android.content.pm.extra.UNARCHIVE_ID"  

### EXTRA_UNARCHIVE_PACKAGE_NAME

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_UNARCHIVE_PACKAGE_NAME
```

Extra field for the package name of a package that is requested to be unarchived. Sent as part of the[Intent.ACTION_UNARCHIVE_PACKAGE](https://developer.android.com/reference/android/content/Intent#ACTION_UNARCHIVE_PACKAGE)intent.

<br />

Constant Value: "android.content.pm.extra.UNARCHIVE_PACKAGE_NAME"  

### EXTRA_UNARCHIVE_STATUS

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_UNARCHIVE_STATUS
```

Current status of an unarchive operation. Will be one of[UNARCHIVAL_OK](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_OK),[UNARCHIVAL_ERROR_USER_ACTION_NEEDED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_USER_ACTION_NEEDED),[UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE),[UNARCHIVAL_ERROR_NO_CONNECTIVITY](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_NO_CONNECTIVITY),[UNARCHIVAL_GENERIC_ERROR](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_GENERIC_ERROR),[UNARCHIVAL_ERROR_INSTALLER_DISABLED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSTALLER_DISABLED)or[UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED).

If the status is not[UNARCHIVAL_OK](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_OK), then[Intent.EXTRA_INTENT](https://developer.android.com/reference/android/content/Intent#EXTRA_INTENT)will be set with an intent for a corresponding follow-up action (e.g. storage clearing dialog) or a failure dialog.

Used as part of[requestUnarchive(String, IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller#requestUnarchive(java.lang.String,%20android.content.IntentSender))to return the status of the unarchival through the[IntentSender](https://developer.android.com/reference/android/content/IntentSender).

<br />

**See also:**

- [requestUnarchive(String, IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller#requestUnarchive(java.lang.String,%20android.content.IntentSender))

Constant Value: "android.content.pm.extra.UNARCHIVE_STATUS"  

### PACKAGE_SOURCE_DOWNLOADED_FILE

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PACKAGE_SOURCE_DOWNLOADED_FILE
```

Code indicating that the package being installed comes from a file that was downloaded to the device by the user. For use in place of[PACKAGE_SOURCE_LOCAL_FILE](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_LOCAL_FILE)when the installer knows the package was downloaded.

<br />

Constant Value: 4 (0x00000004)  

### PACKAGE_SOURCE_LOCAL_FILE

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PACKAGE_SOURCE_LOCAL_FILE
```

Code indicating that the package being installed comes from a local file on the device. A file manager that is facilitating the installation of an APK file would use this.

<br />

Constant Value: 3 (0x00000003)  

### PACKAGE_SOURCE_OTHER

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PACKAGE_SOURCE_OTHER
```

Code indicating that the package being installed is from a source not reflected by any other package source constant.

<br />

Constant Value: 1 (0x00000001)  

### PACKAGE_SOURCE_STORE

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PACKAGE_SOURCE_STORE
```

Code indicating that the package being installed is from a store. An app store that installs an app for the user would use this.

<br />

Constant Value: 2 (0x00000002)  

### PACKAGE_SOURCE_UNSPECIFIED

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PACKAGE_SOURCE_UNSPECIFIED
```

The installer did not call[PackageInstaller.SessionParams.setPackageSource(int)](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams#setPackageSource(int))to specify the package source.

<br />

Constant Value: 0 (0x00000000)  

### STATUS_FAILURE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE
```

The operation failed in a generic way. The system will always try to provide a more specific failure reason, but in some rare cases this may be delivered.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)

Constant Value: 1 (0x00000001)  

### STATUS_FAILURE_ABORTED

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_ABORTED
```

The operation failed because it was actively aborted. For example, the user actively declined requested permissions, or the session was abandoned.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)

Constant Value: 3 (0x00000003)  

### STATUS_FAILURE_BLOCKED

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_BLOCKED
```

The operation failed because it was blocked. For example, a device policy may be blocking the operation, a package verifier may have blocked the operation, or the app may be required for core system operation.

The result may also contain[EXTRA_OTHER_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_OTHER_PACKAGE_NAME)with the specific package blocking the install.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)
- [EXTRA_OTHER_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_OTHER_PACKAGE_NAME)

Constant Value: 2 (0x00000002)  

### STATUS_FAILURE_CONFLICT

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_CONFLICT
```

The operation failed because it conflicts (or is inconsistent with) with another package already installed on the device. For example, an existing permission, incompatible certificates, etc. The user may be able to uninstall another app to fix the issue.

The result may also contain[EXTRA_OTHER_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_OTHER_PACKAGE_NAME)with the specific package identified as the cause of the conflict.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)
- [EXTRA_OTHER_PACKAGE_NAME](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_OTHER_PACKAGE_NAME)

Constant Value: 5 (0x00000005)  

### STATUS_FAILURE_INCOMPATIBLE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_INCOMPATIBLE
```

The operation failed because it is fundamentally incompatible with this device. For example, the app may require a hardware feature that doesn't exist, it may be missing native code for the ABIs supported by the device, or it requires a newer SDK version, etc. Starting in[Build.VERSION_CODES.UPSIDE_DOWN_CAKE](https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE), an app with only 32-bit native code can still be installed on a device that supports both 64-bit and 32-bit ABIs. However, a warning dialog will be displayed when the app is launched.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)

Constant Value: 7 (0x00000007)  

### STATUS_FAILURE_INVALID

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_INVALID
```

The operation failed because one or more of the APKs was invalid. For example, they might be malformed, corrupt, incorrectly signed, mismatched, etc.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)

Constant Value: 4 (0x00000004)  

### STATUS_FAILURE_STORAGE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_STORAGE
```

The operation failed because of storage issues. For example, the device may be running low on space, or external media may be unavailable. The user may be able to help free space or insert different external media.

The result may also contain[EXTRA_STORAGE_PATH](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STORAGE_PATH)with the path to the storage device that caused the failure.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)
- [EXTRA_STORAGE_PATH](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STORAGE_PATH)

Constant Value: 6 (0x00000006)  

### STATUS_FAILURE_TIMEOUT

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILURE_TIMEOUT
```

The operation failed because it didn't complete within the specified timeout.

<br />

**See also:**

- [EXTRA_STATUS_MESSAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS_MESSAGE)

Constant Value: 8 (0x00000008)  

### STATUS_PENDING_USER_ACTION

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_PENDING_USER_ACTION
```

User action is currently required to proceed. You can launch the intent activity described by[Intent.EXTRA_INTENT](https://developer.android.com/reference/android/content/Intent#EXTRA_INTENT)to involve the user and continue.

You may choose to immediately launch the intent if the user is actively using your app. Otherwise, you should use a notification to guide the user back into your app before launching.

<br />

**See also:**

- [Intent.getParcelableExtra(String)](https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String))

Constant Value: -1 (0xffffffff)  

### STATUS_SUCCESS

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_SUCCESS
```

The operation succeeded.

<br />

Constant Value: 0 (0x00000000)  

### UNARCHIVAL_ERROR_INSTALLER_DISABLED

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_ERROR_INSTALLER_DISABLED
```

The installer responsible for the unarchival is disabled.

The system will return this status if appropriate. Installers do not need to verify for this error.

<br />

Constant Value: 4 (0x00000004)  

### UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED
```

The installer responsible for the unarchival has been uninstalled

The system will return this status if appropriate. Installers do not need to verify for this error.

<br />

Constant Value: 5 (0x00000005)  

### UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE
```

Not enough storage to unarchive the application.

The installer can optionally provide a`userActionIntent`for a space-clearing dialog. If no action is provided, then a generic intent[StorageManager.ACTION_MANAGE_STORAGE](https://developer.android.com/reference/android/os/storage/StorageManager#ACTION_MANAGE_STORAGE)is started instead.

<br />

Constant Value: 2 (0x00000002)  

### UNARCHIVAL_ERROR_NO_CONNECTIVITY

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_ERROR_NO_CONNECTIVITY
```

The device is not connected to the internet

<br />

Constant Value: 3 (0x00000003)  

### UNARCHIVAL_ERROR_USER_ACTION_NEEDED

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_ERROR_USER_ACTION_NEEDED
```

The user needs to interact with the installer to enable the installation.

An example use case for this could be that the user needs to login to allow the download for a paid app.

<br />

Constant Value: 1 (0x00000001)  

### UNARCHIVAL_GENERIC_ERROR

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_GENERIC_ERROR
```

Generic error: The app cannot be unarchived.

<br />

Constant Value: 100 (0x00000064)  

### UNARCHIVAL_OK

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int UNARCHIVAL_OK
```

The unarchival is possible and will commence.

Note that this does not mean that the unarchival has completed. This status should be sent before any longer asynchronous action (e.g. app download) is started.

<br />

Constant Value: 0 (0x00000000)

## Public methods

### abandonSession

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void abandonSession (int sessionId)
```

Completely abandon the given session, destroying all staged data and rendering it invalid. Abandoned sessions will be reported to[SessionCallback](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback)listeners as failures. This is equivalent to opening the session and calling[Session.abandon()](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#abandon()).

<br />

|        Parameters         ||
|-------------|--------------|
| `sessionId` | `int` <br /> |

|                                                                             Throws                                                                             ||
|------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | when the caller does not own the session, or the session is invalid. |

### checkInstallConstraints

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void checkInstallConstraints (List<String> packageNames, 
                PackageInstaller.InstallConstraints constraints, 
                Executor executor, 
                Consumer<PackageInstaller.InstallConstraintsResult> callback)
```

Check if install constraints are satisfied for the given packages. Note this query result is just a hint and subject to race because system states could change anytime in-between this query and committing the session. The result is returned by a callback because some constraints might take a long time to evaluate.

<br />

|                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                            ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageNames` | `List`: a list of package names to check the constraints for installation This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `constraints`  | `PackageInstaller.InstallConstraints`: the constraints for installation. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `executor`     | `Executor`: the[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)on which to invoke the callback This value cannot be`null`. Callback and listener events are dispatched through this[Executor](https://developer.android.com/reference/java/util/concurrent/Executor), providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use[Context.getMainExecutor()](https://developer.android.com/reference/android/content/Context#getMainExecutor()). Otherwise, provide an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)that dispatches to an appropriate thread. <br /> |
| `callback`     | `Consumer`: called when the[InstallConstraintsResult](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraintsResult)is ready This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

|                                                                                                                                   Throws                                                                                                                                    ||
|------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | if the given packages' installer of record doesn't match the caller's own package name or the installerPackageName set by the caller doesn't match the caller's own package name. |

### commitSessionAfterInstallConstraintsAreMet

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void commitSessionAfterInstallConstraintsAreMet (int sessionId, 
                IntentSender statusReceiver, 
                PackageInstaller.InstallConstraints constraints, 
                long timeoutMillis)
```

Commit the session when all constraints are satisfied. This is a convenient method to combine[waitForInstallConstraints(java.util.List, android.content.pm.PackageInstaller.InstallConstraints, android.content.IntentSender, long)](https://developer.android.com/reference/android/content/pm/PackageInstaller#waitForInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20android.content.IntentSender,%20long))and[Session.commit(IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender)).

Once this method is called, the session is sealed and no additional mutations may be performed on the session. In the case of timeout, you may commit the session again using this method or[Session.commit(IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender))for retries.

<br />

|                                                                                                                                                          Parameters                                                                                                                                                           ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `sessionId`      | `int`: the session ID to commit when all constraints are satisfied. <br />                                                                                                                                                                                                                                  |
| `statusReceiver` | `IntentSender`: Called when the state of the session changes. Intents sent to this receiver contain[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value cannot be`null`. <br /> |
| `constraints`    | `PackageInstaller.InstallConstraints`: The requirements to satisfy before committing the session. This value cannot be`null`. <br />                                                                                                                                                                        |
| `timeoutMillis`  | `long`: The maximum time to wait, in milliseconds until the constraints are satisfied. The caller will be notified via`statusReceiver`if timeout happens before commit. Value is a non-negative duration in milliseconds. <br />                                                                            |

|                                                                                                                                      Throws                                                                                                                                       ||
|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the`statusReceiver`from an immutable[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent)when caller has a target SDK of API 35 or above. |

### createSession

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int createSession (PackageInstaller.SessionParams params)
```

Create a new session using the given parameters, returning a unique ID that represents the session. Once created, the session can be opened multiple times across multiple device boots.

The system may automatically destroy sessions that have not been finalized (either committed or abandoned) within a reasonable period of time, typically on the order of a day.

<br />

|                                   Parameters                                   ||
|----------|----------------------------------------------------------------------|
| `params` | `PackageInstaller.SessionParams`: This value cannot be`null`. <br /> |

|                                                                                                 Returns                                                                                                  ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | positive, non-zero unique ID that represents the created session. This ID remains consistent across device reboots until the session is finalized. IDs are not reused during a given boot. <br /> |

|                                                                                                              Throws                                                                                                               ||
|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if parameters were unsatisfiable, such as lack of disk space or unavailable media.                                        |
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException)               | when installation services are unavailable, such as when called from a restricted user.                                   |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | when[SessionParams](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams)is invalid. |

### getActiveStagedSession

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public PackageInstaller.SessionInfo getActiveStagedSession ()
```

<br />

**This method was deprecated in API level 30.**   
Use[getActiveStagedSessions()](https://developer.android.com/reference/android/content/pm/PackageInstaller#getActiveStagedSessions())as there can be more than one active staged session

Returns first active staged session, or`null`if there is none.

For more information on what sessions are considered active see[SessionInfo.isStagedSessionActive()](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo#isStagedSessionActive()).

<br />

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo) | <br /> |

### getActiveStagedSessions

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<PackageInstaller.SessionInfo> getActiveStagedSessions ()
```

Returns list of active staged sessions. Returns empty list if there is none.

For more information on what sessions are considered active see \*[SessionInfo.isStagedSessionActive()](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo#isStagedSessionActive()).

<br />

|                                                                                                             Returns                                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | This value cannot be`null`. <br /> |

### getAllSessions

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<PackageInstaller.SessionInfo> getAllSessions ()
```

Return list of all known install sessions, regardless of the installer. Callers need to either declare \<queries\> element with the specific package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be the session owner to retrieve these details.

<br />

|                                                                                                             Returns                                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | This value cannot be`null`. <br /> |

### getDeveloperVerificationServiceProvider

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  

```
public final ComponentName getDeveloperVerificationServiceProvider ()
```

Return the component name of the developer verification service provider, for the purpose of interacting with the specific verifier in relation to extension parameters and response structure. Return null if the system verifier service provider is not available to the caller, or if there is no such provider specified by the system.

<br />

|                                            Returns                                             ||
|----------------------------------------------------------------------------------------|--------|
| [ComponentName](https://developer.android.com/reference/android/content/ComponentName) | <br /> |

### getMySessions

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<PackageInstaller.SessionInfo> getMySessions ()
```

Return list of all known install sessions owned by the calling app.

<br />

|                                                                                                             Returns                                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | This value cannot be`null`. <br /> |

### getSessionInfo

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public PackageInstaller.SessionInfo getSessionInfo (int sessionId)
```

Return details for a specific session. Callers need to either declare \<queries\> element with the specific package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be the session owner to retrieve these details.

<br />

|        Parameters         ||
|-------------|--------------|
| `sessionId` | `int` <br /> |

|                                                                                                  Returns                                                                                                  ||
|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo) | details for the requested session, or`null`if the session does not exist. <br /> |

### getStagedSessions

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<PackageInstaller.SessionInfo> getStagedSessions ()
```

Return list of all staged install sessions. Callers need to either declare \<queries\> element with the specific package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be the session owner to retrieve these details.

<br />

|                                                                                                             Returns                                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[PackageInstaller.SessionInfo](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo)`>` | This value cannot be`null`. <br /> |

### installExistingPackage

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void installExistingPackage (String packageName, 
                int installReason, 
                IntentSender statusReceiver)
```

Install the given package, which already exists on the device, for the user for which this installer was created.

This will[all restricted permissions](https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(java.util.Set<java.lang.String>)).  
Requires[Manifest.permission.INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)and android.Manifest.permission.INSTALL_EXISTING_PACKAGES

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageName`    | `String`: The package to install. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `installReason`  | `int`: Reason for install. Value is[PackageManager.INSTALL_REASON_UNKNOWN](https://developer.android.com/reference/android/content/pm/PackageManager#INSTALL_REASON_UNKNOWN),[PackageManager.INSTALL_REASON_POLICY](https://developer.android.com/reference/android/content/pm/PackageManager#INSTALL_REASON_POLICY),[PackageManager.INSTALL_REASON_DEVICE_RESTORE](https://developer.android.com/reference/android/content/pm/PackageManager#INSTALL_REASON_DEVICE_RESTORE),[PackageManager.INSTALL_REASON_DEVICE_SETUP](https://developer.android.com/reference/android/content/pm/PackageManager#INSTALL_REASON_DEVICE_SETUP),[PackageManager.INSTALL_REASON_USER](https://developer.android.com/reference/android/content/pm/PackageManager#INSTALL_REASON_USER), or android.content.pm.PackageManager.INSTALL_REASON_ROLLBACK <br /> |
| `statusReceiver` | `IntentSender`: Where to deliver the result of the operation indicated by the extra[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value may be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

### installPackageArchived

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void installPackageArchived (ArchivedPackageInfo archivedPackageInfo, 
                PackageInstaller.SessionParams sessionParams, 
                IntentSender statusReceiver)
```

Install package in an archived state.  
Requires[Manifest.permission.INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)

<br />

|                                                                                                                                                             Parameters                                                                                                                                                             ||
|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `archivedPackageInfo` | `ArchivedPackageInfo`: archived package data such as package name, signature etc. This value cannot be`null`. <br />                                                                                                                                                                                        |
| `sessionParams`       | `PackageInstaller.SessionParams`: used to create an underlying installation session This value cannot be`null`. <br />                                                                                                                                                                                      |
| `statusReceiver`      | `IntentSender`: Called when the state of the session changes. Intents sent to this receiver contain[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value cannot be`null`. <br /> |

**See also:**

- [createSession(SessionParams)](https://developer.android.com/reference/android/content/pm/PackageInstaller#createSession(android.content.pm.PackageInstaller.SessionParams))
- [PackageInstaller.Session.commit(IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender))  

### openSession

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public PackageInstaller.Session openSession (int sessionId)
```

Open an existing session to actively perform work. To succeed, the caller must be the owner of the install session.

<br />

|        Parameters         ||
|-------------|--------------|
| `sessionId` | `int` <br /> |

|                                                                       Returns                                                                       ||
|-----------------------------------------------------------------------------------------------------------------|------------------------------------|
| [PackageInstaller.Session](https://developer.android.com/reference/android/content/pm/PackageInstaller.Session) | This value cannot be`null`. <br /> |

|                                                                                    Throws                                                                                    ||
|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)               | if parameters were unsatisfiable, such as lack of disk space or unavailable media. |
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | when the caller does not own the session, or the session is invalid.               |

### registerSessionCallback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void registerSessionCallback (PackageInstaller.SessionCallback callback, 
                Handler handler)
```

Register to watch for session lifecycle events. No special permissions are required to watch for these events.

<br />

|                                                          Parameters                                                           ||
|------------|-------------------------------------------------------------------------------------------------------------------|
| `callback` | `PackageInstaller.SessionCallback`: This value cannot be`null`. <br />                                            |
| `handler`  | `Handler`: to dispatch callback events through, otherwise uses calling thread. This value cannot be`null`. <br /> |

### registerSessionCallback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void registerSessionCallback (PackageInstaller.SessionCallback callback)
```

Register to watch for session lifecycle events. The callers need to be the session owner or have the android.permission.QUERY_ALL_PACKAGES to watch for these events.

<br />

|                                     Parameters                                     ||
|------------|------------------------------------------------------------------------|
| `callback` | `PackageInstaller.SessionCallback`: This value cannot be`null`. <br /> |

### reportUnarchivalState

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void reportUnarchivalState (PackageInstaller.UnarchivalState unarchivalState)
```

Reports the state of an unarchival to the system.  
Requires[Manifest.permission.INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)or[Manifest.permission.REQUEST_INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_INSTALL_PACKAGES)

<br />

|                                        Parameters                                         ||
|-------------------|------------------------------------------------------------------------|
| `unarchivalState` | `PackageInstaller.UnarchivalState`: This value cannot be`null`. <br /> |

|                                                                                      Throws                                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [PackageManager.NameNotFoundException](https://developer.android.com/reference/android/content/pm/PackageManager.NameNotFoundException) | if no unarchival with`unarchiveId`exists |

**See also:**

- [for the different state options.](https://developer.android.com/reference/android/content/pm/PackageInstaller.UnarchivalState)  

### reportUnarchivalStatus

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void reportUnarchivalStatus (int unarchiveId, 
                int status, 
                long requiredStorageBytes, 
                PendingIntent userActionIntent)
```

Reports the status of an unarchival to the system.  
Requires[Manifest.permission.INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)or[Manifest.permission.REQUEST_INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_INSTALL_PACKAGES)

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ||
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `unarchiveId`          | `int`: the ID provided by the system as part of the intent.action.UNARCHIVE broadcast with EXTRA_UNARCHIVE_ID. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `status`               | `int`: is used for the system to provide the user with necessary follow-up steps or errors. Value is android.content.pm.PackageInstaller.UNARCHIVAL_STATUS_UNSET,[UNARCHIVAL_OK](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_OK),[UNARCHIVAL_ERROR_USER_ACTION_NEEDED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_USER_ACTION_NEEDED),[UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE),[UNARCHIVAL_ERROR_NO_CONNECTIVITY](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_NO_CONNECTIVITY),[UNARCHIVAL_ERROR_INSTALLER_DISABLED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSTALLER_DISABLED),[UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_ERROR_INSTALLER_UNINSTALLED), or[UNARCHIVAL_GENERIC_ERROR](https://developer.android.com/reference/android/content/pm/PackageInstaller#UNARCHIVAL_GENERIC_ERROR) <br /> |
| `requiredStorageBytes` | `long`: If the error is UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE this field should be set to specify how many additional bytes of storage are required to unarchive the app. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `userActionIntent`     | `PendingIntent`: Optional intent to start a follow up action required to facilitate the unarchival flow (e.g. user needs to log in). This value may be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

|                                                                                      Throws                                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [PackageManager.NameNotFoundException](https://developer.android.com/reference/android/content/pm/PackageManager.NameNotFoundException) | if no unarchival with`unarchiveId`exists |

### requestArchive

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void requestArchive (String packageName, 
                IntentSender statusReceiver)
```

Requests to archive a package which is currently installed.

During the archival process, the apps APKs and cache are removed from the device while the user data is kept. Through the[requestUnarchive(String, IntentSender)](https://developer.android.com/reference/android/content/pm/PackageInstaller#requestUnarchive(java.lang.String,%20android.content.IntentSender))call, apps can be restored again through their responsible installer.

Archived apps are returned as displayable apps through the[LauncherApps](https://developer.android.com/reference/android/content/pm/LauncherApps)APIs and will be displayed to users with UI treatment to highlight that said apps are archived. If a user taps on an archived app, the app will be unarchived and the restoration process is communicated.  
Requires[Manifest.permission.DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#DELETE_PACKAGES)or[Manifest.permission.REQUEST_DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_DELETE_PACKAGES)

<br />

|                                                          Parameters                                                           ||
|------------------|-------------------------------------------------------------------------------------------------------------|
| `packageName`    | `String`: This value cannot be`null`. <br />                                                                |
| `statusReceiver` | `IntentSender`: Callback used to notify when the operation is completed. This value cannot be`null`. <br /> |

|                                                                                                        Throws                                                                                                         ||
|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| [PackageManager.NameNotFoundException](https://developer.android.com/reference/android/content/pm/PackageManager.NameNotFoundException) | If`packageName`isn't found or not available to the caller or isn't archived. |

### requestUnarchive

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void requestUnarchive (String packageName, 
                IntentSender statusReceiver)
```

Requests to unarchive a currently archived package.

Sends a request to unarchive an app to the responsible installer. The installer is determined by[InstallSourceInfo.getUpdateOwnerPackageName()](https://developer.android.com/reference/android/content/pm/InstallSourceInfo#getUpdateOwnerPackageName()), or[InstallSourceInfo.getInstallingPackageName()](https://developer.android.com/reference/android/content/pm/InstallSourceInfo#getInstallingPackageName())if the former value is null.

The installation will happen asynchronously and can be observed through[Intent.ACTION_PACKAGE_ADDED](https://developer.android.com/reference/android/content/Intent#ACTION_PACKAGE_ADDED).  
Requires[Manifest.permission.INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#INSTALL_PACKAGES)or[Manifest.permission.REQUEST_INSTALL_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_INSTALL_PACKAGES)

<br />

|                                                                                                                                                                                    Parameters                                                                                                                                                                                     ||
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageName`    | `String`: This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                    |
| `statusReceiver` | `IntentSender`: Callback used to notify whether the installer has accepted the unarchival request or an error has occurred. The status update will be sent though[EXTRA_UNARCHIVE_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_UNARCHIVE_STATUS). Only one status will be sent. This value cannot be`null`. <br /> |

|                                                                                                                                   Throws                                                                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| [PackageManager.NameNotFoundException](https://developer.android.com/reference/android/content/pm/PackageManager.NameNotFoundException) | If`packageName`isn't found or not visible to the caller or if the package has no installer on the device anymore to unarchive it. |
| [IOException](https://developer.android.com/reference/java/io/IOException)                                                              | If parameters were unsatisfiable, such as lack of disk space.                                                                     |

### uninstall

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void uninstall (String packageName, 
                IntentSender statusReceiver)
```

Uninstall the given package, removing it completely from the device. This method is available to:

- the current "installer of record" for the package
- the device owner
- the affiliated profile owner

<br />

Requires[Manifest.permission.DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#DELETE_PACKAGES)or[Manifest.permission.REQUEST_DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_DELETE_PACKAGES)

<br />

<br />

|                                                                                                                                                  Parameters                                                                                                                                                   ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageName`    | `String`: The package to uninstall. This value cannot be`null`. <br />                                                                                                                                                                                                                      |
| `statusReceiver` | `IntentSender`: Where to deliver the result of the operation indicated by the extra[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value cannot be`null`. <br /> |

**See also:**

- [DevicePolicyManager](https://developer.android.com/reference/android/app/admin/DevicePolicyManager)  

### uninstall

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void uninstall (VersionedPackage versionedPackage, 
                int flags, 
                IntentSender statusReceiver)
```

Uninstall the given package with a specific version code, removing it completely from the device. This method is only available to the current "installer of record" for the package. If the version code of the package does not match the one passed in the versioned package argument this method is a no-op. Use[PackageManager.VERSION_CODE_HIGHEST](https://developer.android.com/reference/android/content/pm/PackageManager#VERSION_CODE_HIGHEST)to uninstall the latest version of the package.  
Requires[Manifest.permission.DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#DELETE_PACKAGES)or[Manifest.permission.REQUEST_DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_DELETE_PACKAGES)

<br />

|                                                                                                                                                                              Parameters                                                                                                                                                                               ||
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `versionedPackage` | `VersionedPackage`: The versioned package to uninstall. This value cannot be`null`. <br />                                                                                                                                                                                                                                                        |
| `flags`            | `int`: Flags for uninstall. Value is either`0`or a combination of android.content.pm.PackageManager.DELETE_KEEP_DATA, android.content.pm.PackageManager.DELETE_ALL_USERS, android.content.pm.PackageManager.DELETE_SYSTEM_APP, android.content.pm.PackageManager.DELETE_DONT_KILL_APP, and android.content.pm.PackageManager.DELETE_CHATTY <br /> |
| `statusReceiver`   | `IntentSender`: Where to deliver the result of the operation indicated by the extra[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value cannot be`null`. <br />                                                       |

### uninstall

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void uninstall (VersionedPackage versionedPackage, 
                IntentSender statusReceiver)
```

Uninstall the given package with a specific version code, removing it completely from the device. If the version code of the package does not match the one passed in the versioned package argument this method is a no-op. Use[PackageManager.VERSION_CODE_HIGHEST](https://developer.android.com/reference/android/content/pm/PackageManager#VERSION_CODE_HIGHEST)to uninstall the latest version of the package.

This method is available to:

- the current "installer of record" for the package
- the device owner
- the affiliated profile owner

<br />

Requires[Manifest.permission.DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#DELETE_PACKAGES)or[Manifest.permission.REQUEST_DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#REQUEST_DELETE_PACKAGES)

<br />

<br />

|                                                                                                                                                   Parameters                                                                                                                                                    ||
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `versionedPackage` | `VersionedPackage`: The versioned package to uninstall. This value cannot be`null`. <br />                                                                                                                                                                                                  |
| `statusReceiver`   | `IntentSender`: Where to deliver the result of the operation indicated by the extra[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value cannot be`null`. <br /> |

**See also:**

- [DevicePolicyManager](https://developer.android.com/reference/android/app/admin/DevicePolicyManager)  

### uninstallExistingPackage

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void uninstallExistingPackage (String packageName, 
                IntentSender statusReceiver)
```

Uninstall the given package for the user for which this installer was created if the package will still exist for other users on the device.  
Requires[Manifest.permission.DELETE_PACKAGES](https://developer.android.com/reference/android/Manifest.permission#DELETE_PACKAGES)

<br />

|                                                                                                                                                 Parameters                                                                                                                                                 ||
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageName`    | `String`: The package to uninstall. This value cannot be`null`. <br />                                                                                                                                                                                                                   |
| `statusReceiver` | `IntentSender`: Where to deliver the result of the operation indicated by the extra[EXTRA_STATUS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_STATUS). Refer to the individual status codes on how to handle them. This value may be`null`. <br /> |

### unregisterSessionCallback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void unregisterSessionCallback (PackageInstaller.SessionCallback callback)
```

Unregister a previously registered callback.

<br />

|                                     Parameters                                     ||
|------------|------------------------------------------------------------------------|
| `callback` | `PackageInstaller.SessionCallback`: This value cannot be`null`. <br /> |

### updateSessionAppIcon

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void updateSessionAppIcon (int sessionId, 
                Bitmap appIcon)
```

Update the icon representing the app being installed in a specific session. This should be roughly[ActivityManager.getLauncherLargeIconSize()](https://developer.android.com/reference/android/app/ActivityManager#getLauncherLargeIconSize())in both dimensions.

<br />

|                       Parameters                       ||
|-------------|-------------------------------------------|
| `sessionId` | `int` <br />                              |
| `appIcon`   | `Bitmap`: This value may be`null`. <br /> |

|                                                                             Throws                                                                             ||
|------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | when the caller does not own the session, or the session is invalid. |

### updateSessionAppLabel

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void updateSessionAppLabel (int sessionId, 
                CharSequence appLabel)
```

Update the label representing the app being installed in a specific session.

<br />

|                          Parameters                          ||
|-------------|-------------------------------------------------|
| `sessionId` | `int` <br />                                    |
| `appLabel`  | `CharSequence`: This value may be`null`. <br /> |

|                                                                             Throws                                                                             ||
|------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | when the caller does not own the session, or the session is invalid. |

### waitForInstallConstraints

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void waitForInstallConstraints (List<String> packageNames, 
                PackageInstaller.InstallConstraints constraints, 
                IntentSender callback, 
                long timeoutMillis)
```

Similar to[checkInstallConstraints(java.util.List, android.content.pm.PackageInstaller.InstallConstraints, java.util.concurrent.Executor, java.util.function.Consumer)](https://developer.android.com/reference/android/content/pm/PackageInstaller#checkInstallConstraints(java.util.List<java.lang.String>,%20android.content.pm.PackageInstaller.InstallConstraints,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.content.pm.PackageInstaller.InstallConstraintsResult>)), but the callback is invoked only when the constraints are satisfied or after timeout.

Note: the device idle constraint might take a long time to evaluate. The system will ensure the constraint is evaluated completely before handling timeout.

<br />

|                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                              ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageNames`  | `List`: a list of package names to check the constraints for installation This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `constraints`   | `PackageInstaller.InstallConstraints`: the constraints for installation. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `callback`      | `IntentSender`: Called when the constraints are satisfied or after timeout. Intents sent to this callback contain:[Intent.EXTRA_PACKAGES](https://developer.android.com/reference/android/content/Intent#EXTRA_PACKAGES)for the input package names,[EXTRA_INSTALL_CONSTRAINTS](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_INSTALL_CONSTRAINTS)for the input constraints,[EXTRA_INSTALL_CONSTRAINTS_RESULT](https://developer.android.com/reference/android/content/pm/PackageInstaller#EXTRA_INSTALL_CONSTRAINTS_RESULT)for the result. This value cannot be`null`. <br /> |
| `timeoutMillis` | `long`: The maximum time to wait, in milliseconds until the constraints are satisfied. Valid range is from 0 to one week.`0`means the callback will be invoked immediately no matter constraints are satisfied or not. Value is a non-negative duration in milliseconds. <br />                                                                                                                                                                                                                                                                                                                                    |

|                                                                                                                                   Throws                                                                                                                                    ||
|------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException) | if the given packages' installer of record doesn't match the caller's own package name or the installerPackageName set by the caller doesn't match the caller's own package name. |