registerReceiver

fun registerReceiver(intentFilter: IntentFilter, flags: Int = ContextCompat.RECEIVER_NOT_EXPORTED, onEvent: (Intent?) -> Unit)

Registers a BroadcastReceiver that will be automatically unregistered when the composable is disposed.

Parameters

intentFilter

the IntentFilter to register the receiver for.

flags

additional flags to control the receiver. Default is ContextCompat.RECEIVER_NOT_EXPORTED.

onEvent

the callback that will be called when a broadcast is received.