PackageInstaller.SessionCallback


public static abstract class PackageInstaller.SessionCallback
extends Object

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


Events for observing session lifecycle.

A typical session lifecycle looks like this:

  • An installer creates a session to indicate pending app delivery. All install details are available at this point.
  • The installer opens the session to deliver APK data. Note that a session may be opened and closed multiple times as network connectivity changes. The installer may deliver periodic progress updates.
  • The installer commits or abandons the session, resulting in the session being finished.

Summary

Public constructors

SessionCallback()

Public methods

abstract void onActiveChanged(int sessionId, boolean active)

Active state for session has been changed.

abstract void onBadgingChanged(int sessionId)

Badging details for an existing session has changed.

abstract void onCreated(int sessionId)

New session has been created.

abstract void onFinished(int sessionId, boolean success)

Session has completely finished, either with success or failure.

abstract void onProgressChanged(int sessionId, float progress)

Progress for given session has been updated.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(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(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()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

SessionCallback

public SessionCallback ()

Public methods

onActiveChanged

Added in API level 21
public abstract void onActiveChanged (int sessionId, 
                boolean active)

Active state for session has been changed.

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

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

Parameters
sessionId int

active boolean

onBadgingChanged

Added in API level 21
public abstract void onBadgingChanged (int sessionId)

Badging details for an existing session has changed. For example, the app icon or label has been updated.

Parameters
sessionId int

onCreated

Added in API level 21
public abstract void onCreated (int sessionId)

New session has been created. Details about the session can be obtained from PackageInstaller.getSessionInfo(int).

Parameters
sessionId int

onFinished

Added in API level 21
public abstract void onFinished (int sessionId, 
                boolean success)

Session has completely finished, either with success or failure.

Parameters
sessionId int

success boolean

onProgressChanged

Added in API level 21
public abstract void onProgressChanged (int sessionId, 
                float progress)

Progress for given session has been updated.

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

Parameters
sessionId int

progress float