Skip to content

Most visited

Recently visited

navigation

PackageInstaller.SessionInfo

public static class PackageInstaller.SessionInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.content.pm.PackageInstaller.SessionInfo


Details for an active install session.

Summary

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<PackageInstaller.SessionInfo> CREATOR

Public methods

Intent createDetailsIntent()

Return an Intent that can be started to view details about this install session.

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Bitmap getAppIcon()

Return an icon representing the app being installed.

CharSequence getAppLabel()

Return a label representing the app being installed.

String getAppPackageName()

Return the package name this session is working with.

int getInstallLocation()

Get the value set in setInstallLocation(int).

int getInstallReason()

Return the reason for installing this package.

String getInstallerPackageName()

Return the package name of the app that owns this session.

int getMode()

Get the mode of the session as set in the constructor of the PackageInstaller.SessionParams.

int getOriginatingUid()

Get the value set in setOriginatingUid(int).

Uri getOriginatingUri()

Get the value set in setOriginatingUri(Uri).

float getProgress()

Return current overall progress of this session, between 0 and 1.

Uri getReferrerUri()

Get the value set in setReferrerUri(Uri)

int getSessionId()

Return the ID for this session.

long getSize()

Get the value as set in setSize(long).

boolean isActive()

Return if this session is currently active.

boolean isSealed()

Return if this session is sealed.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Fields

Public methods

createDetailsIntent

added in API level 21
Intent createDetailsIntent ()

Return an Intent that can be started to view details about this install session. This may surface actions such as pause, resume, or cancel.

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

Returns
Intent

This value may be null.

See also:

describeContents

added in API level 21
int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

getAppIcon

added in API level 21
Bitmap getAppIcon ()

Return an icon representing the app being installed. May be null if unavailable.

Returns
Bitmap

This value may be null.

getAppLabel

added in API level 21
CharSequence getAppLabel ()

Return a label representing the app being installed. May be null if unavailable.

Returns
CharSequence

This value may be null.

getAppPackageName

added in API level 21
String getAppPackageName ()

Return the package name this session is working with. May be null if unknown.

Returns
String

This value may be null.

getInstallLocation

added in API level 27
int getInstallLocation ()

Get the value set in setInstallLocation(int).

Returns
int

getInstallReason

added in API level 26
int getInstallReason ()

Return the reason for installing this package.

Returns
int The install reason.

Value is INSTALL_REASON_UNKNOWN, INSTALL_REASON_POLICY, INSTALL_REASON_DEVICE_RESTORE, INSTALL_REASON_DEVICE_SETUP or INSTALL_REASON_USER.

getInstallerPackageName

added in API level 21
String getInstallerPackageName ()

Return the package name of the app that owns this session.

Returns
String

This value may be null.

getMode

added in API level 27
int getMode ()

Get the mode of the session as set in the constructor of the PackageInstaller.SessionParams.

Returns
int One of MODE_FULL_INSTALL or MODE_INHERIT_EXISTING

getOriginatingUid

added in API level 27
int getOriginatingUid ()

Get the value set in setOriginatingUid(int).

Returns
int

getOriginatingUri

added in API level 27
Uri getOriginatingUri ()

Get the value set in setOriginatingUri(Uri).

Returns
Uri

This value may be null.

getProgress

added in API level 21
float getProgress ()

Return current overall progress of this session, between 0 and 1.

Note that this progress may not directly correspond to the value reported by setStagingProgress(float), as the system may carve out a portion of the overall progress to represent its own internal installation work.

Returns
float

getReferrerUri

added in API level 27
Uri getReferrerUri ()

Get the value set in setReferrerUri(Uri)

Returns
Uri

This value may be null.

getSessionId

added in API level 21
int getSessionId ()

Return the ID for this session.

Returns
int

getSize

added in API level 27
long getSize ()

Get the value as set in setSize(long).

The value is a hint and does not have to match the actual size.

Returns
long

isActive

added in API level 21
boolean isActive ()

Return if this session is currently active.

A session is considered active whenever there is ongoing forward progress being made, such as the installer holding an open PackageInstaller.Session instance while streaming data into place, or the system optimizing code as the result of commit(IntentSender).

If the installer closes the PackageInstaller.Session without committing, the session is considered inactive until the installer opens the session again.

Returns
boolean

isSealed

added in API level 26
boolean isSealed ()

Return if this session is sealed.

Once sealed, no further changes may be made to the session. A session is sealed the moment commit(IntentSender) is called.

Returns
boolean

writeToParcel

added in API level 21
void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.

flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)