IntentSpec

Builds one launch Intent of a shortcut.

action defaults to Intent.ACTION_VIEW because the system requires every shortcut intent to carry an action. Prefer an explicit target activity over implicit resolution so the shortcut cannot be intercepted by other apps.

Properties

Link copied to clipboard

Intent action. Defaults to Intent.ACTION_VIEW; must not end up null.

Link copied to clipboard
var data: Uri?

Data URI, e.g. "myapp://compose".toUri().

Link copied to clipboard
var flags: Int

Intent flags, e.g. Intent.FLAG_ACTIVITY_CLEAR_TASK.

Link copied to clipboard
var type: String?

MIME type. Setting it does not clear data (unlike Intent.setType).

Functions

Link copied to clipboard
fun addFlags(flag: Int)

Adds flag to flags.

Link copied to clipboard
fun putExtra(name: String, value: Bundle?)
fun putExtra(name: String, value: Parcelable?)
fun putExtra(name: String, value: Serializable?)
fun putExtra(name: String, value: Array<String?>?)
fun putExtra(name: String, value: Boolean)
fun putExtra(name: String, value: BooleanArray?)
fun putExtra(name: String, value: Byte)
fun putExtra(name: String, value: Char)
fun putExtra(name: String, value: CharSequence?)
fun putExtra(name: String, value: Double)
fun putExtra(name: String, value: DoubleArray?)
fun putExtra(name: String, value: Float)
fun putExtra(name: String, value: FloatArray?)
fun putExtra(name: String, value: Int)
fun putExtra(name: String, value: IntArray?)
fun putExtra(name: String, value: Long)
fun putExtra(name: String, value: LongArray?)
fun putExtra(name: String, value: Short)
fun putExtra(name: String, value: String?)
Link copied to clipboard
fun putExtras(bundle: Bundle)

Copies every extra from bundle into the intent.

Link copied to clipboard
inline fun <T : Activity> target()

Targets activity T explicitly (recommended over implicit resolution).

fun target(activityClass: Class<out Activity>)

Targets activityClass explicitly (recommended over implicit resolution).