register

@JvmOverloads
protected fun TorServiceUI.Receiver.register(filter: IntentFilter, permission: String?, scheduler: Handler?, exported: Boolean?, flags: Int = 0): Disposable.Once?(source)

Registers a BroadcastReceiver with the Service context and pipes the Intent from BroadcastReceiver.onReceive to Receiver.onReceive.

NOTE: Underlying BroadcastReceiver are not automatically unregistered. The returned Disposable should be invoked when done with the Receiver, or from onDestroy override when this instance of TorServiceUI is destroyed. Otherwise, there will be a reference leak.

Return

Disposable.Once to unregister the underlying BroadcastReceiver or null if TorServiceUI.isDestroyed was true.

Parameters

flags

Only utilized if API 26+. Default 0 (none).

exported

Only utilized if non-null and API 33+, adding flag Context.RECEIVER_EXPORTED or Context.RECEIVER_NOT_EXPORTED automatically. This must be non-null if the receiver is not being registered for system broadcasts, otherwise a SecurityException will be thrown on API 34+.

See also