Added in U Extensions 15

EmbeddedPhotoPickerClient


public 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

default void onCameraButtonClicked()

Reports that the user clicked on the camera button within the embedded photo picker.

default void onNavigationCompleted(int tabId)

Reports that navigation to a tab has completed, triggered either programmatically via EmbeddedPhotoPickerSession.navigateTo(int) or by user interaction.

default void onSearchStatusChanged(boolean isSearchEnabled)

Reports when search feature availability changes in the embedded photopicker.

abstract void onSelectionComplete()

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

abstract void onSessionError(Throwable cause)

Reports that terminal error has occurred in the session.

abstract void onSessionOpened(EmbeddedPhotoPickerSession session)

Reports that session of app with photopicker was established successfully.

abstract void onUriPermissionGranted(List<Uri> uris)

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

abstract void onUriPermissionRevoked(List<Uri> uris)

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

Public methods

onCameraButtonClicked

Added in U Extensions 25
public void onCameraButtonClicked ()

Reports that the user clicked on the camera button within the embedded photo picker.

This callback is only invoked when the host app has enabled the camera button via EmbeddedPhotoPickerFeatureInfo.Builder.setCameraButtonEnabled(boolean).

Upon receiving this callback, the host app can launch its own camera flow, trigger a system camera intent (e.g., MediaStore.ACTION_IMAGE_CAPTURE), or present a custom capture interface.

This callback is dispatched on the Executor provided by the host app during session creation.

onNavigationCompleted

Added in U Extensions 25
public void onNavigationCompleted (int tabId)

Reports that navigation to a tab has completed, triggered either programmatically via EmbeddedPhotoPickerSession.navigateTo(int) or by user interaction.

This callback is only invoked if allowed navigation tabs are configured via EmbeddedPhotoPickerFeatureInfo.Builder.setAllowedNavigationTabs.

Parameters
tabId int: The identifier of the tab ERROR[hidden: NavigationTabConstants.NavigationTab] that was navigated to.
Value is one of the following:

onSearchStatusChanged

Added in U Extensions 25
public void onSearchStatusChanged (boolean isSearchEnabled)

Reports when search feature availability changes in the embedded photopicker.

This callback is only invoked if search status events are enabled via EmbeddedPhotoPickerFeatureInfo.Builder.setSearchStatusEventsEnabled(boolean).

Parameters
isSearchEnabled boolean: true if search is available, false otherwise.

onSelectionComplete

Added in U Extensions 15
public abstract void onSelectionComplete ()

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 U Extensions 15
public abstract void onSessionError (Throwable cause)

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

Added in U Extensions 15
public abstract void onSessionOpened (EmbeddedPhotoPickerSession session)

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

Added in U Extensions 15
public abstract void onUriPermissionGranted (List<Uri> uris)

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 List: This value cannot be null.

onUriPermissionRevoked

Added in U Extensions 15
public abstract void onUriPermissionRevoked (List<Uri> uris)

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

Parameters
uris List: This value cannot be null.