Added in API level 30

DataShareWriteAdapter


interface DataShareWriteAdapter
android.view.contentcapture.DataShareWriteAdapter

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

Summary

Public methods
open Unit
onError(errorCode: Int)

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

abstract Unit

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

abstract Unit

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
open fun onError(errorCode: Int): Unit

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 android.view.contentcapture.ContentCaptureManager#DATA_SHARE_ERROR_UNKNOWN, android.view.contentcapture.ContentCaptureManager#DATA_SHARE_ERROR_CONCURRENT_REQUEST, or android.view.contentcapture.ContentCaptureManager#DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED

onRejected

Added in API level 30
abstract fun onRejected(): Unit

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

onWrite

Added in API level 30
abstract fun onWrite(destination: ParcelFileDescriptor): Unit

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.