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

# PackageInstaller.SessionCallback

*** ** * ** ***

` public static abstract class PackageInstaller.SessionCallback `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

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.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback#SessionCallback()() ` |

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback#onActiveChanged(int,%20boolean)(int sessionId, boolean active) ` Active state for session has been changed. |
| ` abstract void` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback#onBadgingChanged(int)(int sessionId) ` Badging details for an existing session has changed. |
| ` abstract void` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback#onCreated(int)(int sessionId) ` New session has been created. |
| ` abstract void` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback#onFinished(int,%20boolean)(int sessionId, boolean success) ` Session has completely finished, either with success or failure. |
| ` abstract void` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback#onProgressChanged(int,%20float)(int sessionId, float progress) ` Progress for given session has been updated. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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*.

## Public constructors

### SessionCallback

```
public SessionCallback ()
```

<br />

<br />

## Public methods

### onActiveChanged

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

```
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 `https://developer.android.com/reference/android/content/pm/PackageInstaller.Session` instance while streaming data into place, or the system optimizing code as the result of `https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#commit(android.content.IntentSender)`.

If the installer closes the `https://developer.android.com/reference/android/content/pm/PackageInstaller.Session` without committing, the session is considered inactive until the installer opens the session again.

<br />

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

### onBadgingChanged

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

```
public abstract void onBadgingChanged (int sessionId)
```

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

<br />

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

### onCreated

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

```
public abstract void onCreated (int sessionId)
```

New session has been created. Details about the session can be obtained from `https://developer.android.com/reference/android/content/pm/PackageInstaller#getSessionInfo(int)`.

<br />

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

### onFinished

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

```
public abstract void onFinished (int sessionId, 
                boolean success)
```

Session has completely finished, either with success or failure.

<br />

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

### onProgressChanged

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

```
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 `https://developer.android.com/reference/android/content/pm/PackageInstaller.Session#setStagingProgress(float)`, as the system may carve out a portion of the overall progress to represent its own internal installation work.

<br />

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