IntentUtils

Properties

Link copied to clipboard
private val random: Random
Link copied to clipboard
private const val REQUEST_CODE_MAX: Int

Sets a range for request codes to not run into "java.lang.IllegalArgumentException: requestCode should be >= 0" when handling intents.

Link copied to clipboard
private const val REQUEST_CODE_MIN: Int

A large minimum value for request codes to help prevent any potential trampling of any present client request codes.

Functions

Link copied to clipboard
fun addComponentAndSendBroadcast(context: Context, intent: Intent)

Queries the package manager to retrieve all components that respond to the given intent and sends them a broadcast with an explicit intent.

Link copied to clipboard

PendingIntent flags used for immutable intents. This is the default set of flags.

Link copied to clipboard

PendingIntent flags used for mutable intents, such as those used for locations or any case where data is added to the sent intent.

Link copied to clipboard

Returns a random request code for this intent. Request codes are used to differentiate between multiple active pending intents.