Added in API level 30

DataShareWriteAdapter


public interface DataShareWriteAdapter

android.view.contentcapture.DataShareWriteAdapter


Adapter class used by apps to share data with the Content Capture service.

Summary

Public methods

default void onError(int errorCode)

Method invoked when an error occurred, for example sessions has not been started or terminated unsuccessfully.

abstract void onRejected()

Data share sessions has been rejected by the Content Capture service.

abstract void onWrite(ParcelFileDescriptor destination)

Method invoked when the data share session has been started and the app needs to start writing into the file used for sharing.

Public methods

onError

Added in API level 30
public void onError (int errorCode)

Method invoked when an error occurred, for example sessions has not been started or terminated unsuccessfully.

Parameters
errorCode int: the error code corresponding to an ERROR_* value. Value is ContentCaptureManager.DATA_SHARE_ERROR_UNKNOWN, ContentCaptureManager.DATA_SHARE_ERROR_CONCURRENT_REQUEST, or ContentCaptureManager.DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED

onRejected

Added in API level 30
public abstract void onRejected ()

Data share sessions has been rejected by the Content Capture service.

onWrite

Added in API level 30
public abstract void onWrite (ParcelFileDescriptor destination)

Method invoked when the data share session has been started and the app needs to start writing into the file used for sharing.

App needs to handle explicitly cases when the file descriptor is closed and handle gracefully if IOExceptions happen.

Parameters
destination ParcelFileDescriptor: file descriptor used to write data into. This value cannot be null.