Google is committed to advancing racial equity for Black communities. See how.

IntentCompat

class IntentCompat
kotlin.Any
   ↳ androidx.core.content.IntentCompat

Helper for accessing features in android.content.Intent.

Summary

Constants
static String

Activity Action: Creates a reminder.

static String

Indicates an activity optimized for Leanback mode, and that should be displayed in the Leanback launcher.

static String

A constant String that is associated with the Intent, used with android.content.Intent#ACTION_SEND to supply an alternative to android.content.Intent#EXTRA_TEXT as HTML formatted text.

static String

Used as a boolean extra field in android.content.Intent#ACTION_VIEW intents to indicate that content should immediately be played without any intermediate screens that require additional user input, e.

static String

Optional extra specifying a time in milliseconds since the Epoch.

Public methods
static Intent
makeMainSelectorActivity(@NonNull selectorAction: String, @NonNull selectorCategory: String)

Make an Intent for the main activity of an application, without specifying a specific activity to run but giving a selector to find the activity.

Constants

ACTION_CREATE_REMINDER

static val ACTION_CREATE_REMINDER: String

Activity Action: Creates a reminder.

Input: android.content.Intent#EXTRA_TITLE The title of the reminder that will be shown to the user. android.content.Intent#EXTRA_TEXT The reminder text that will be shown to the user. The intent should at least specify a title or a text. EXTRA_TIME The time when the reminder will be shown to the user. The time is specified in milliseconds since the Epoch (optional).

Output: Nothing.

Value: "android.intent.action.CREATE_REMINDER"

CATEGORY_LEANBACK_LAUNCHER

static val CATEGORY_LEANBACK_LAUNCHER: String

Indicates an activity optimized for Leanback mode, and that should be displayed in the Leanback launcher.

Value: "android.intent.category.LEANBACK_LAUNCHER"

EXTRA_HTML_TEXT

static val EXTRA_HTML_TEXT: String

A constant String that is associated with the Intent, used with android.content.Intent#ACTION_SEND to supply an alternative to android.content.Intent#EXTRA_TEXT as HTML formatted text. Note that you must also supply android.content.Intent#EXTRA_TEXT.

Value: "android.intent.extra.HTML_TEXT"

EXTRA_START_PLAYBACK

static val EXTRA_START_PLAYBACK: String

Used as a boolean extra field in android.content.Intent#ACTION_VIEW intents to indicate that content should immediately be played without any intermediate screens that require additional user input, e.g. a profile selection screen or a details page.

Value: "android.intent.extra.START_PLAYBACK"

EXTRA_TIME

static val EXTRA_TIME: String

Optional extra specifying a time in milliseconds since the Epoch. The value must be non-negative.

Type: long

Value: "android.intent.extra.TIME"

Public methods

makeMainSelectorActivity

@NonNull static fun makeMainSelectorActivity(
    @NonNull selectorAction: String,
    @NonNull selectorCategory: String
): Intent

Make an Intent for the main activity of an application, without specifying a specific activity to run but giving a selector to find the activity. This results in a final Intent that is structured the same as when the application is launched from Home. For anything else that wants to launch an application in the same way, it is important that they use an Intent structured the same way, and can use this function to ensure this is the case.

The returned Intent has Intent#ACTION_MAIN as its action, and includes the category Intent#CATEGORY_LAUNCHER. This does not have Intent#FLAG_ACTIVITY_NEW_TASK set, though typically you will want to do that through Intent#addFlags(int) on the returned Intent.

Parameters
selectorAction String: The action name of the Intent's selector.
selectorCategory String: The name of a category to add to the Intent's selector.
Return
Intent Returns a newly created Intent that can be used to launch the activity as a main application entry.