# EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener

Artifact: [androidx.photopicker:photopicker-embedded](https://developer.android.com/jetpack/androidx/releases/photopicker) [View Source](https://cs.android.com/search?q=file:androidx/photopicker/embedded/EmbeddedPhotoPickerView.kt+class:androidx.photopicker.embedded.EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener) Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

*** ** * ** ***


```
interface EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener
```

<br />

*** ** * ** ***

A state change listener which supplies callbacks for state changes related to any currently running Embedded PhotoPicker session.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/photopicker/embedded/EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener#onSelectionComplete()()` Reports that the user is done with their selection and should collapse the picker. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/photopicker/embedded/EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener#onSessionError(kotlin.Throwable)(throwable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` Reports that terminal error has occurred in the session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/photopicker/embedded/EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener#onSessionOpened(android.widget.photopicker.EmbeddedPhotoPickerSession)(newSession: https://developer.android.com/reference/android/widget/photopicker/EmbeddedPhotoPickerSession.html)` Reports that session of app with photopicker was established successfully. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/photopicker/embedded/EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener#onUriPermissionGranted(kotlin.collections.List)(uris: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/net/Uri.html>)` Reports that URI permission has been granted to the item selected by the user. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/photopicker/embedded/EmbeddedPhotoPickerView.EmbeddedPhotoPickerStateChangeListener#onUriPermissionRevoked(kotlin.collections.List)(uris: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/net/Uri.html>)` Reports that URI permission has been revoked of the item deselected by the user. |

## Public functions

### onSelectionComplete

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun onSelectionComplete(): Unit
```

Reports that the user is done with their selection and should collapse the picker.

This doesn't necessarily mean that the session should be closed, but rather the user has indicated that they are done selecting images and should go back to the app.

### onSessionError

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun onSessionError(throwable: Throwable): Unit
```

Reports that terminal error has occurred in the session. Any further events notified on this session will be ignored. The embedded photopicker view will be torn down along with session upon error.

### onSessionOpened

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun onSessionOpened(newSession: EmbeddedPhotoPickerSession): Unit
```

Reports that session of app with photopicker was established successfully. Also shares `https://developer.android.com/reference/android/widget/photopicker/EmbeddedPhotoPickerSession.html` handle containing the view with the caller that should be used to notify the session of UI events.

### onUriPermissionGranted

```
fun onUriPermissionGranted(uris: List<Uri>): Unit
```

Reports that URI permission has been granted to the item selected by the user.

It is possible that the permission to the URI was revoked if the item was unselected by user before the URI is actually accessed by the caller. Hence callers must handle `https://developer.android.com/reference/java/lang/SecurityException.html` when attempting to read or use the URI in response to this callback.

### onUriPermissionRevoked

```
fun onUriPermissionRevoked(uris: List<Uri>): Unit
```

Reports that URI permission has been revoked of the item deselected by the user.