Stay organized with collections
Save and categorize content based on your preferences.
EmbeddedPhotoPickerClient
interface EmbeddedPhotoPickerClient
Callback to define mechanisms by which can apps can receive notifications about different events from embedded photopicker for the corresponding Session (EmbeddedPhotoPickerSession
).
PhotoPicker will invoke the methods of this interface on the Executor provided by the caller in EmbeddedPhotoPickerProvider.openSession
Any methods on a single instance of this object will always be invoked in a non-concurrent or thread safe way. In other words, all methods are invoked in a serial execution manner on the executor passed by the caller. Hence callers wouldn't need any buffer or locking mechanism on their end.
Summary
Public methods |
abstract Unit |
Reports that the user is done with their selection and should collapse the picker.
|
abstract Unit |
Reports that terminal error has occurred in the session.
|
abstract Unit |
Reports that session of app with photopicker was established successfully.
|
abstract Unit |
Reports that URI permission has been granted to the item selected by the user.
|
abstract Unit |
Reports that URI permission has been revoked of the item deselected by the user.
|
Public methods
onSelectionComplete
abstract 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
abstract fun onSessionError(cause: 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.
Parameters |
cause |
Throwable: This value cannot be null . |
onSessionOpened
abstract fun onSessionOpened(session: EmbeddedPhotoPickerSession): Unit
Reports that session of app with photopicker was established successfully. Also shares EmbeddedPhotoPickerSession
handle containing the view with the caller that should be used to notify the session of UI events.
onUriPermissionGranted
abstract fun onUriPermissionGranted(uris: MutableList<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 SecurityException
when attempting to read or use the URI in response to this callback.
onUriPermissionRevoked
abstract fun onUriPermissionRevoked(uris: MutableList<Uri!>): Unit
Reports that URI permission has been revoked of the item deselected by the user.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-03-13 UTC.
[null,null,["Last updated 2025-03-13 UTC."],[],[],null,["# EmbeddedPhotoPickerClient\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [U Extensions 15](https://developer.android.com/sdkExtensions)\n\nEmbeddedPhotoPickerClient\n=========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/widget/photopicker/EmbeddedPhotoPickerClient \"View this page in Java\") \n\n```\ninterface EmbeddedPhotoPickerClient\n```\n\n|-----------------------------------------------------------|\n| [android.widget.photopicker.EmbeddedPhotoPickerClient](#) |\n\nCallback to define mechanisms by which can apps can receive notifications about different events from embedded photopicker for the corresponding Session ([EmbeddedPhotoPickerSession](/reference/kotlin/android/widget/photopicker/EmbeddedPhotoPickerSession)).\n\nPhotoPicker will invoke the methods of this interface on the Executor provided by the caller in [EmbeddedPhotoPickerProvider.openSession](/reference/kotlin/android/widget/photopicker/EmbeddedPhotoPickerProvider#openSession(android.os.IBinder,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20android.widget.photopicker.EmbeddedPhotoPickerFeatureInfo,%20java.util.concurrent.Executor,%20android.widget.photopicker.EmbeddedPhotoPickerClient))\n\nAny methods on a single instance of this object will always be invoked in a non-concurrent or thread safe way. In other words, all methods are invoked in a serial execution manner on the executor passed by the caller. Hence callers wouldn't need any buffer or locking mechanism on their end.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSelectionComplete](#onSelectionComplete())`()` Reports that the user is done with their selection and should collapse the picker. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSessionError](#onSessionError(kotlin.Throwable))`(`cause:` `[Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`)` Reports that terminal error has occurred in the session. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSessionOpened](#onSessionOpened(android.widget.photopicker.EmbeddedPhotoPickerSession))`(`session:` `[EmbeddedPhotoPickerSession](/reference/kotlin/android/widget/photopicker/EmbeddedPhotoPickerSession)`)` Reports that session of app with photopicker was established successfully. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onUriPermissionGranted](#onUriPermissionGranted(kotlin.collections.MutableList))`(`uris:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[Uri](../../net/Uri.html#)!\u003e`)` Reports that URI permission has been granted to the item selected by the user. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onUriPermissionRevoked](#onUriPermissionRevoked(kotlin.collections.MutableList))`(`uris:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[Uri](../../net/Uri.html#)!\u003e`)` Reports that URI permission has been revoked of the item deselected by the user. |\n\nPublic methods\n--------------\n\n### onSelectionComplete\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [U Extensions 15](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun onSelectionComplete(): Unit\n```\n\nReports that the user is done with their selection and should collapse the picker.\n\nThis 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. \n\n### onSessionError\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [U Extensions 15](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun onSessionError(cause: Throwable): Unit\n```\n\nReports 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.\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------------------|\n| `cause` | [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html): This value cannot be `null`. |\n\n### onSessionOpened\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [U Extensions 15](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun onSessionOpened(session: EmbeddedPhotoPickerSession): Unit\n```\n\nReports that session of app with photopicker was established successfully. Also shares [EmbeddedPhotoPickerSession](/reference/kotlin/android/widget/photopicker/EmbeddedPhotoPickerSession) handle containing the view with the caller that should be used to notify the session of UI events.\n\n| Parameters ||\n|-----------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `session` | [EmbeddedPhotoPickerSession](/reference/kotlin/android/widget/photopicker/EmbeddedPhotoPickerSession): This value cannot be `null`. |\n\n### onUriPermissionGranted\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [U Extensions 15](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun onUriPermissionGranted(uris: MutableList\u003cUri!\u003e): Unit\n```\n\nReports that URI permission has been granted to the item selected by the user.\n\nIt 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 `SecurityException` when attempting to read or use the URI in response to this callback.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `uris` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[Uri](../../net/Uri.html#)!\\\u003e: This value cannot be `null`. |\n\n### onUriPermissionRevoked\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [U Extensions 15](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun onUriPermissionRevoked(uris: MutableList\u003cUri!\u003e): Unit\n```\n\nReports that URI permission has been revoked of the item deselected by the user.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `uris` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[Uri](../../net/Uri.html#)!\\\u003e: This value cannot be `null`. |"]]