EmbeddedPhotoPickerClient


interface EmbeddedPhotoPickerClient
android.widget.photopicker.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.

Parameters
session EmbeddedPhotoPickerSession: This value cannot be null.

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.

Parameters
uris MutableList<Uri!>: This value cannot be null.

onUriPermissionRevoked

abstract fun onUriPermissionRevoked(uris: MutableList<Uri!>): Unit

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

Parameters
uris MutableList<Uri!>: This value cannot be null.