IntentPayloadReader

Resolves and reads intent payloads, preferring extras then URIs.

Functions

Link copied to clipboard
fun readBytes(intent: Intent, activity: ComponentActivity): ByteArray?

Resolves the payload URI from the intent and reads it (size-limited), returning the bytes or null when no readable payload is present.

Link copied to clipboard
fun readText(intent: Intent, activity: ComponentActivity? = null): String?

Returns text from the intent, checking EXTRA_TEXT, the app's text extra, ACTION_PROCESS_TEXT and finally a text-like data URI, or null.