public class Intent extends Object implements Parcelable, Cloneable
startActivity
to
launch an Activity
,
broadcastIntent
to
send it to any interested BroadcastReceiver
components,
and Context.startService(android.content.Intent)
or
Context.bindService(android.content.Intent, android.content.ServiceConnection, int)
to communicate with a
background Service
.
An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.
For information about how to create and resolve intents, read the Intents and Intent Filters developer guide.
The primary pieces of information in an intent are:
action -- The general action to be performed, such as
ACTION_VIEW
, ACTION_EDIT
, ACTION_MAIN
,
etc.
data -- The data to operate on, such as a person record
in the contacts database, expressed as a Uri
.
Some examples of action/data pairs are:
ACTION_VIEW
content://contacts/people/1 -- Display
information about the person whose identifier is "1".
ACTION_DIAL
content://contacts/people/1 -- Display
the phone dialer with the person filled in.
ACTION_VIEW
tel:123 -- Display
the phone dialer with the given number filled in. Note how the
VIEW action does what is considered the most reasonable thing for
a particular URI.
ACTION_DIAL
tel:123 -- Display
the phone dialer with the given number filled in.
ACTION_EDIT
content://contacts/people/1 -- Edit
information about the person whose identifier is "1".
ACTION_VIEW
content://contacts/people/ -- Display
a list of people, which the user can browse through. This example is a
typical top-level entry into the Contacts application, showing you the
list of people. Selecting a particular person to view would result in a
new intent { ACTION_VIEW
content://contacts/people/N }
being used to start an activity to display that person.
In addition to these primary attributes, there are a number of secondary attributes that you can also include with an intent:
category -- Gives additional information about the action
to execute. For example, CATEGORY_LAUNCHER
means it should
appear in the Launcher as a top-level application, while
CATEGORY_ALTERNATIVE
means it should be included in a list
of alternative actions the user can perform on a piece of data.
type -- Specifies an explicit type (a MIME type) of the intent data. Normally the type is inferred from the data itself. By setting this attribute, you disable that evaluation and force an explicit type.
component -- Specifies an explicit name of a component class to use for the intent. Normally this is determined by looking at the other information in the intent (the action, data/type, and categories) and matching that with a component that can handle it. If this attribute is set then none of the evaluation is performed, and this component is used exactly as is. By specifying this attribute, all of the other Intent attributes become optional.
extras -- This is a Bundle
of any additional information.
This can be used to provide extended information to the component.
For example, if we have a action to send an e-mail message, we could
also include extra pieces of data here to supply a subject, body,
etc.
Here are some examples of other operations you can specify as intents using these additional parameters:
ACTION_MAIN
with category CATEGORY_HOME
--
Launch the home screen.
ACTION_GET_CONTENT
with MIME type
vnd.android.cursor.item/phone
-- Display the list of people's phone numbers, allowing the user to
browse through them and pick one and return it to the parent activity.
ACTION_GET_CONTENT
with MIME type
*/* and category CATEGORY_OPENABLE
-- Display all pickers for data that can be opened with
ContentResolver.openInputStream()
,
allowing the user to pick one of them and then some data inside of it
and returning the resulting URI to the caller. This can be used,
for example, in an e-mail application to allow the user to pick some
data to include as an attachment.
There are a variety of standard Intent action and category constants
defined in the Intent class, but applications can also define their own.
These strings use Java-style scoping, to ensure they are unique -- for
example, the standard ACTION_VIEW
is called
"android.intent.action.VIEW".
Put together, the set of actions, data types, categories, and extra data defines a language for the system allowing for the expression of phrases such as "call john smith's cell". As applications are added to the system, they can extend this language by adding new actions, types, and categories, or they can modify the behavior of existing phrases by supplying their own activities that handle them.
There are two primary forms of intents you will use.
Explicit Intents have specified a component (via
setComponent(android.content.ComponentName)
or setClass(android.content.Context, java.lang.Class<?>)
), which provides the exact
class to be run. Often these will not include any other information,
simply being a way for an application to launch various internal
activities it has as the user interacts with the application.
Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent.
When using implicit intents, given such an arbitrary intent we need to
know what to do with it. This is handled by the process of Intent
resolution, which maps an Intent to an Activity
,
BroadcastReceiver
, or Service
(or sometimes two or
more activities/receivers) that can handle it.
The intent resolution mechanism basically revolves around matching an
Intent against all of the <intent-filter> descriptions in the
installed application packages. (Plus, in the case of broadcasts, any BroadcastReceiver
objects explicitly registered with Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)
.) More
details on this can be found in the documentation on the IntentFilter
class.
There are three pieces of information in the Intent that are used for
resolution: the action, type, and category. Using this information, a query
is done on the PackageManager
for a component that can handle the
intent. The appropriate component is determined based on the intent
information supplied in the AndroidManifest.xml
file as
follows:
The action, if given, must be listed by the component as one it handles.
The type is retrieved from the Intent's data, if not already supplied in the Intent. Like the action, if a type is included in the intent (either explicitly or implicitly in its data), then this must be listed by the component as one it handles.
content:
URI and where no explicit
type is included in the Intent, instead the scheme of the
intent data (such as http:
or mailto:
) is
considered. Again like the action, if we are matching a scheme it
must be listed by the component as one it can handle.
The categories, if supplied, must all be listed
by the activity as categories it handles. That is, if you include
the categories CATEGORY_LAUNCHER
and
CATEGORY_ALTERNATIVE
, then you will only resolve to components
with an intent that lists both of those categories.
Activities will very often need to support the
CATEGORY_DEFAULT
so that they can be found by
Context.startActivity()
.
For example, consider the Note Pad sample application that allows user to browse through a list of notes data and view details about individual items. Text in italics indicate places were you would replace a name with one specific to your own package.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.notepad"> <application android:icon="@drawable/app_notes" android:label="@string/app_name"> <provider class=".NotePadProvider" android:authorities="com.google.provider.NotePad" /> <activity class=".NotesList" android:label="@string/title_notes_list"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.GET_CONTENT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> </intent-filter> </activity> <activity class=".NoteEditor" android:label="@string/title_note"> <intent-filter android:label="@string/resolve_edit"> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.INSERT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> </intent-filter> </activity> <activity class=".TitleEditor" android:label="@string/title_edit_title" android:theme="@android:style/Theme.Dialog"> <intent-filter android:label="@string/resolve_title"> <action android:name="com.android.notepad.action.EDIT_TITLE" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.ALTERNATIVE" /> <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> </intent-filter> </activity> </application> </manifest>
The first activity,
com.android.notepad.NotesList
, serves as our main
entry into the app. It can do three things as described by its three intent
templates:
<intent-filter> <action android:name="android.intent.action.MAIN
" /> <category android:name="android.intent.category.LAUNCHER
" /> </intent-filter>
This provides a top-level entry into the NotePad application: the standard MAIN action is a main entry point (not requiring any other information in the Intent), and the LAUNCHER category says that this entry point should be listed in the application launcher.
<intent-filter> <action android:name="android.intent.action.VIEW
" /> <action android:name="android.intent.action.EDIT
" /> <action android:name="android.intent.action.PICK
" /> <category android:name="android.intent.category.DEFAULT
" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> </intent-filter>
This declares the things that the activity can do on a directory of
notes. The type being supported is given with the <type> tag, where
vnd.android.cursor.dir/vnd.google.note
is a URI from which
a Cursor of zero or more items (vnd.android.cursor.dir
) can
be retrieved which holds our note pad data (vnd.google.note
).
The activity allows the user to view or edit the directory of data (via
the VIEW and EDIT actions), or to pick a particular note and return it
to the caller (via the PICK action). Note also the DEFAULT category
supplied here: this is required for the
Context.startActivity
method to resolve your
activity when its component name is not explicitly specified.
<intent-filter> <action android:name="android.intent.action.GET_CONTENT
" /> <category android:name="android.intent.category.DEFAULT
" /> <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> </intent-filter>
This filter describes the ability to return to the caller a note selected by
the user without needing to know where it came from. The data type
vnd.android.cursor.item/vnd.google.note
is a URI from which
a Cursor of exactly one (vnd.android.cursor.item
) item can
be retrieved which contains our note pad data (vnd.google.note
).
The GET_CONTENT action is similar to the PICK action, where the activity
will return to its caller a piece of data selected by the user. Here,
however, the caller specifies the type of data they desire instead of
the type of data the user will be picking from.
Given these capabilities, the following intents will resolve to the NotesList activity:
{ action=android.app.action.MAIN } matches all of the activities that can be used as top-level entry points into an application.
{ action=android.app.action.MAIN, category=android.app.category.LAUNCHER } is the actual intent used by the Launcher to populate its top-level list.
{ action=android.intent.action.VIEW data=content://com.google.provider.NotePad/notes } displays a list of all the notes under "content://com.google.provider.NotePad/notes", which the user can browse through and see the details on.
{ action=android.app.action.PICK data=content://com.google.provider.NotePad/notes } provides a list of the notes under "content://com.google.provider.NotePad/notes", from which the user can pick a note whose data URL is returned back to the caller.
{ action=android.app.action.GET_CONTENT type=vnd.android.cursor.item/vnd.google.note } is similar to the pick action, but allows the caller to specify the kind of data they want back so that the system can find the appropriate activity to pick something of that data type.
The second activity,
com.android.notepad.NoteEditor
, shows the user a single
note entry and allows them to edit it. It can do two things as described
by its two intent templates:
<intent-filter android:label="@string/resolve_edit"> <action android:name="android.intent.action.VIEW
" /> <action android:name="android.intent.action.EDIT
" /> <category android:name="android.intent.category.DEFAULT
" /> <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> </intent-filter>
The first, primary, purpose of this activity is to let the user interact
with a single note, as decribed by the MIME type
vnd.android.cursor.item/vnd.google.note
. The activity can
either VIEW a note or allow the user to EDIT it. Again we support the
DEFAULT category to allow the activity to be launched without explicitly
specifying its component.
<intent-filter> <action android:name="android.intent.action.INSERT
" /> <category android:name="android.intent.category.DEFAULT
" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> </intent-filter>
The secondary use of this activity is to insert a new note entry into an existing directory of notes. This is used when the user creates a new note: the INSERT action is executed on the directory of notes, causing this activity to run and have the user create the new note data which it then adds to the content provider.
Given these capabilities, the following intents will resolve to the NoteEditor activity:
{ action=android.intent.action.VIEW data=content://com.google.provider.NotePad/notes/{ID} } shows the user the content of note {ID}.
{ action=android.app.action.EDIT data=content://com.google.provider.NotePad/notes/{ID} } allows the user to edit the content of note {ID}.
{ action=android.app.action.INSERT data=content://com.google.provider.NotePad/notes } creates a new, empty note in the notes list at "content://com.google.provider.NotePad/notes" and allows the user to edit it. If they keep their changes, the URI of the newly created note is returned to the caller.
The last activity,
com.android.notepad.TitleEditor
, allows the user to
edit the title of a note. This could be implemented as a class that the
application directly invokes (by explicitly setting its component in
the Intent), but here we show a way you can publish alternative
operations on existing data:
<intent-filter android:label="@string/resolve_title"> <action android:name="com.android.notepad.action.EDIT_TITLE" /> <category android:name="android.intent.category.DEFAULT
" /> <category android:name="android.intent.category.ALTERNATIVE
" /> <category android:name="android.intent.category.SELECTED_ALTERNATIVE
" /> <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> </intent-filter>
In the single intent template here, we
have created our own private action called
com.android.notepad.action.EDIT_TITLE
which means to
edit the title of a note. It must be invoked on a specific note
(data type vnd.android.cursor.item/vnd.google.note
) like the previous
view and edit actions, but here displays and edits the title contained
in the note data.
In addition to supporting the default category as usual, our title editor
also supports two other standard categories: ALTERNATIVE and
SELECTED_ALTERNATIVE. Implementing
these categories allows others to find the special action it provides
without directly knowing about it, through the
PackageManager.queryIntentActivityOptions(android.content.ComponentName, android.content.Intent[], android.content.Intent, int)
method, or
more often to build dynamic menu items with
Menu.addIntentOptions(int, int, int, android.content.ComponentName, android.content.Intent[], android.content.Intent, int, android.view.MenuItem[])
. Note that in the intent
template here was also supply an explicit name for the template
(via android:label="@string/resolve_title"
) to better control
what the user sees when presented with this activity as an alternative
action to the data they are viewing.
Given these capabilities, the following intent will resolve to the TitleEditor activity:
{ action=com.android.notepad.action.EDIT_TITLE data=content://com.google.provider.NotePad/notes/{ID} } displays and allows the user to edit the title associated with note {ID}.
These are the current standard actions that Intent defines for launching
activities (usually through Context.startActivity(android.content.Intent)
. The most
important, and by far most frequently used, are ACTION_MAIN
and
ACTION_EDIT
.
ACTION_MAIN
ACTION_VIEW
ACTION_ATTACH_DATA
ACTION_EDIT
ACTION_PICK
ACTION_CHOOSER
ACTION_GET_CONTENT
ACTION_DIAL
ACTION_CALL
ACTION_SEND
ACTION_SENDTO
ACTION_ANSWER
ACTION_INSERT
ACTION_DELETE
ACTION_RUN
ACTION_SYNC
ACTION_PICK_ACTIVITY
ACTION_SEARCH
ACTION_WEB_SEARCH
ACTION_FACTORY_TEST
These are the current standard actions that Intent defines for receiving
broadcasts (usually through Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)
or a
<receiver> tag in a manifest).
ACTION_TIME_TICK
ACTION_TIME_CHANGED
ACTION_TIMEZONE_CHANGED
ACTION_BOOT_COMPLETED
ACTION_PACKAGE_ADDED
ACTION_PACKAGE_CHANGED
ACTION_PACKAGE_REMOVED
ACTION_PACKAGE_RESTARTED
ACTION_PACKAGE_DATA_CLEARED
ACTION_PACKAGES_SUSPENDED
ACTION_PACKAGES_UNSUSPENDED
ACTION_UID_REMOVED
ACTION_BATTERY_CHANGED
ACTION_POWER_CONNECTED
ACTION_POWER_DISCONNECTED
ACTION_SHUTDOWN
These are the current standard categories that can be used to further
clarify an Intent via addCategory(java.lang.String)
.
CATEGORY_DEFAULT
CATEGORY_BROWSABLE
CATEGORY_TAB
CATEGORY_ALTERNATIVE
CATEGORY_SELECTED_ALTERNATIVE
CATEGORY_LAUNCHER
CATEGORY_INFO
CATEGORY_HOME
CATEGORY_PREFERENCE
CATEGORY_TEST
CATEGORY_CAR_DOCK
CATEGORY_DESK_DOCK
CATEGORY_LE_DESK_DOCK
CATEGORY_HE_DESK_DOCK
CATEGORY_CAR_MODE
CATEGORY_APP_MARKET
These are the current standard fields that can be used as extra data via
putExtra(java.lang.String, boolean)
.
EXTRA_ALARM_COUNT
EXTRA_BCC
EXTRA_CC
EXTRA_CHANGED_COMPONENT_NAME
EXTRA_DATA_REMOVED
EXTRA_DOCK_STATE
EXTRA_DOCK_STATE_HE_DESK
EXTRA_DOCK_STATE_LE_DESK
EXTRA_DOCK_STATE_CAR
EXTRA_DOCK_STATE_DESK
EXTRA_DOCK_STATE_UNDOCKED
EXTRA_DONT_KILL_APP
EXTRA_EMAIL
EXTRA_INITIAL_INTENTS
EXTRA_INTENT
EXTRA_KEY_EVENT
EXTRA_ORIGINATING_URI
EXTRA_PHONE_NUMBER
EXTRA_REFERRER
EXTRA_REMOTE_INTENT_TOKEN
EXTRA_REPLACING
EXTRA_SHORTCUT_ICON
EXTRA_SHORTCUT_ICON_RESOURCE
EXTRA_SHORTCUT_INTENT
EXTRA_STREAM
EXTRA_SHORTCUT_NAME
EXTRA_SUBJECT
EXTRA_TEMPLATE
EXTRA_TEXT
EXTRA_TITLE
EXTRA_UID
These are the possible flags that can be used in the Intent via
setFlags(int)
and addFlags(int)
. See setFlags(int)
for a list
of all possible flags.
Modifier and Type | Class and Description |
---|---|
static interface |
Intent.AccessUriMode |
static interface |
Intent.CommandOptionHandler |
static interface |
Intent.FillInFlags |
static class |
Intent.FilterComparison
Wrapper class holding an Intent and implementing comparisons on it for
the purpose of filtering.
|
static interface |
Intent.GrantUriMode |
static class |
Intent.ShortcutIconResource
Represents a shortcut/live folder icon resource.
|
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_ADVANCED_SETTINGS_CHANGED
Broadcast Action: The user has switched on advanced settings in the settings app:
state - A boolean value indicating whether the settings is on or off.
|
static String |
ACTION_AIRPLANE_MODE_CHANGED
Broadcast Action: The user has switched the phone into or out of Airplane Mode.
|
static String |
ACTION_ALARM_CHANGED
Alarm Changed Action: This is broadcast when the AlarmClock
application's alarm is set or unset.
|
static String |
ACTION_ALL_APPS
Activity Action: List all available applications.
|
static String |
ACTION_ANSWER
Activity Action: Handle an incoming phone call.
|
static String |
ACTION_APP_ERROR
Activity Action: The user pressed the "Report" button in the crash/ANR dialog.
|
static String |
ACTION_APPLICATION_PREFERENCES
An activity that provides a user interface for adjusting application preferences.
|
static String |
ACTION_APPLICATION_RESTRICTIONS_CHANGED
Broadcast Action: Sent after application restrictions are changed.
|
static String |
ACTION_ASSIST
Activity Action: Perform assist action.
|
static String |
ACTION_ATTACH_DATA
Used to indicate that some piece of data should be attached to some other
place.
|
static String |
ACTION_BATTERY_CHANGED
Broadcast Action: This is a sticky broadcast containing the
charging state, level, and other information about the battery.
|
static String |
ACTION_BATTERY_LOW
Broadcast Action: Indicates low battery condition on the device.
|
static String |
ACTION_BATTERY_OKAY
Broadcast Action: Indicates the battery is now okay after being low.
|
static String |
ACTION_BOOT_COMPLETED
Broadcast Action: This is broadcast once, after the user has finished
booting.
|
static String |
ACTION_BUG_REPORT
Activity Action: Show activity for reporting a bug.
|
static String |
ACTION_CALL
Activity Action: Perform a call to someone specified by the data.
|
static String |
ACTION_CALL_BUTTON
Activity Action: The user pressed the "call" button to go to the dialer
or other appropriate UI for placing a call.
|
static String |
ACTION_CALL_EMERGENCY
Activity Action: Perform a call to an emergency number specified by the
data.
|
static String |
ACTION_CALL_PRIVILEGED
Activity action: Perform a call to any number (emergency or not)
specified by the data.
|
static String |
ACTION_CAMERA_BUTTON
Broadcast Action: The "Camera Button" was pressed.
|
static String |
ACTION_CHOOSER
Activity Action: Display an activity chooser, allowing the user to pick
what they want to before proceeding.
|
static String |
ACTION_CLEAR_DNS_CACHE
Clear DNS Cache Action: This is broadcast when networks have changed and old
DNS entries should be tossed.
|
static String |
ACTION_CLOSE_SYSTEM_DIALOGS
Broadcast Action: This is broadcast when a user action should request a
temporary system dialog to dismiss.
|
static String |
ACTION_CONFIGURATION_CHANGED
Broadcast Action: The current device
Configuration
(orientation, locale, etc) has changed. |
static String |
ACTION_CREATE_DOCUMENT
Activity Action: Allow the user to create a new document.
|
static String |
ACTION_CREATE_SHORTCUT
Activity Action: Creates a shortcut.
|
static String |
ACTION_DATE_CHANGED
Broadcast Action: The date has changed.
|
static String |
ACTION_DEFAULT
A synonym for
ACTION_VIEW , the "standard" action that is
performed on a piece of data. |
static String |
ACTION_DELETE
Activity Action: Delete the given data from its container.
|
static String |
ACTION_DEVICE_STORAGE_FULL
Broadcast Action: A sticky broadcast that indicates a memory full
condition on the device.
|
static String |
ACTION_DEVICE_STORAGE_LOW
Broadcast Action: A sticky broadcast that indicates low memory
condition on the device
This is a protected intent that can only be sent by the system. |
static String |
ACTION_DEVICE_STORAGE_NOT_FULL
Broadcast Action: Indicates memory full condition on the device
no longer exists.
|
static String |
ACTION_DEVICE_STORAGE_OK
Broadcast Action: Indicates low memory condition on the device no longer exists
This is a protected intent that can only be sent by the system. |
static String |
ACTION_DIAL
Activity Action: Dial a number as specified by the data.
|
static String |
ACTION_DISMISS_KEYBOARD_SHORTCUTS
Activity Action: Dismiss the Keyboard Shortcuts Helper screen.
|
static String |
ACTION_DOCK_EVENT
Broadcast Action: A sticky broadcast for changes in the physical
docking state of the device.
|
static String |
ACTION_DREAMING_STARTED
Broadcast Action: Sent after the system starts dreaming.
|
static String |
ACTION_DREAMING_STOPPED
Broadcast Action: Sent after the system stops dreaming.
|
static String |
ACTION_DYNAMIC_SENSOR_CHANGED
Broadcast Action: List of dynamic sensor is changed due to new sensor being connected or
exisiting sensor being disconnected.
|
static String |
ACTION_EDIT
Activity Action: Provide explicit editable access to the given data.
|
static String |
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
Broadcast Action: Resources for a set of packages (which were
previously unavailable) are currently
available since the media on which they exist is available.
|
static String |
ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE
Broadcast Action: Resources for a set of packages are currently
unavailable since the media on which they exist is unavailable.
|
static String |
ACTION_FACTORY_TEST
Activity Action: Main entry point for factory tests.
|
static String |
ACTION_GET_CONTENT
Activity Action: Allow the user to select a particular kind of data and
return it.
|
static String |
ACTION_GET_RESTRICTION_ENTRIES
Broadcast to a specific application to query any supported restrictions to impose
on restricted users.
|
static String |
ACTION_GLOBAL_BUTTON
Broadcast Action: A global button was pressed.
|
static String |
ACTION_GTALK_SERVICE_CONNECTED
Broadcast Action: A GTalk connection has been established.
|
static String |
ACTION_GTALK_SERVICE_DISCONNECTED
Broadcast Action: A GTalk connection has been disconnected.
|
static String |
ACTION_HEADSET_PLUG
Broadcast Action: Wired Headset plugged in or unplugged.
|
static String |
ACTION_IDLE_MAINTENANCE_END
Broadcast Action: A broadcast when idle maintenance should be stopped.
|
static String |
ACTION_IDLE_MAINTENANCE_START
Broadcast Action: A broadcast when idle maintenance can be started.
|
static String |
ACTION_INPUT_METHOD_CHANGED
Broadcast Action: An input method has been changed.
|
static String |
ACTION_INSERT
Activity Action: Insert an empty item into the given container.
|
static String |
ACTION_INSERT_OR_EDIT
Activity Action: Pick an existing item, or insert a new item, and then edit it.
|
static String |
ACTION_INSTALL_EPHEMERAL_PACKAGE
Activity Action: Launch ephemeral installer.
|
static String |
ACTION_INSTALL_PACKAGE
Activity Action: Launch application installer.
|
static String |
ACTION_INTENT_FILTER_NEEDS_VERIFICATION
Broadcast Action: Sent to the system intent filter verifier when an
intent filter needs to be verified.
|
static String |
ACTION_LOCALE_CHANGED
Broadcast Action: The current device's locale has changed.
|
static String |
ACTION_LOCKED_BOOT_COMPLETED
Broadcast Action: This is broadcast once, after the user has finished
booting, but while still in the "locked" state.
|
static String |
ACTION_MAIN
Activity Action: Start as a main entry point, does not expect to
receive data.
|
static String |
ACTION_MANAGE_APP_PERMISSIONS
Activity action: Launch UI to manage the permissions of an app.
|
static String |
ACTION_MANAGE_NETWORK_USAGE
Activity Action: Show settings for managing network data usage of a
specific application.
|
static String |
ACTION_MANAGE_PACKAGE_STORAGE
Broadcast Action: Indicates low memory condition notification acknowledged by user
and package management should be started.
|
static String |
ACTION_MANAGE_PERMISSION_APPS
Activity action: Launch UI to manage which apps have a given permission.
|
static String |
ACTION_MANAGE_PERMISSIONS
Activity action: Launch UI to manage permissions.
|
static String |
ACTION_MANAGED_PROFILE_ADDED
Broadcast sent to the primary user when an associated managed profile is added (the profile
was created and is ready to be used).
|
static String |
ACTION_MANAGED_PROFILE_AVAILABLE
Broadcast sent to the primary user when an associated managed profile has become available.
|
static String |
ACTION_MANAGED_PROFILE_REMOVED
Broadcast sent to the primary user when an associated managed profile is removed.
|
static String |
ACTION_MANAGED_PROFILE_UNAVAILABLE
Broadcast sent to the primary user when an associated managed profile has become unavailable.
|
static String |
ACTION_MANAGED_PROFILE_UNLOCKED
Broadcast sent to the primary user when the credential-encrypted private storage for
an associated managed profile is unlocked.
|
static String |
ACTION_MASTER_CLEAR |
static String |
ACTION_MEDIA_BAD_REMOVAL
Broadcast Action: External media was removed from SD card slot, but mount point was not unmounted.
|
static String |
ACTION_MEDIA_BUTTON
Broadcast Action: The "Media Button" was pressed.
|
static String |
ACTION_MEDIA_CHECKING
Broadcast Action: External media is present, and being disk-checked
The path to the mount point for the checking media is contained in the Intent.mData field.
|
static String |
ACTION_MEDIA_EJECT
Broadcast Action: User has expressed the desire to remove the external storage media.
|
static String |
ACTION_MEDIA_MOUNTED
Broadcast Action: External media is present and mounted at its mount point.
|
static String |
ACTION_MEDIA_NOFS
Broadcast Action: External media is present, but is using an incompatible fs (or is blank)
The path to the mount point for the checking media is contained in the Intent.mData field.
|
static String |
ACTION_MEDIA_REMOVED
Broadcast Action: External media has been removed.
|
static String |
ACTION_MEDIA_RESOURCE_GRANTED
Broadcast Action: Sent when media resource is granted.
|
static String |
ACTION_MEDIA_SCANNER_FINISHED
Broadcast Action: The media scanner has finished scanning a directory.
|
static String |
ACTION_MEDIA_SCANNER_SCAN_FILE
Broadcast Action: Request the media scanner to scan a file and add it to the media database.
|
static String |
ACTION_MEDIA_SCANNER_STARTED
Broadcast Action: The media scanner has started scanning a directory.
|
static String |
ACTION_MEDIA_SHARED
Broadcast Action: External media is unmounted because it is being shared via USB mass storage.
|
static String |
ACTION_MEDIA_UNMOUNTABLE
Broadcast Action: External media is present but cannot be mounted.
|
static String |
ACTION_MEDIA_UNMOUNTED
Broadcast Action: External media is present, but not mounted at its mount point.
|
static String |
ACTION_MEDIA_UNSHARED
Broadcast Action: External media is no longer being shared via USB mass storage.
|
static String |
ACTION_MY_PACKAGE_REPLACED
Broadcast Action: A new version of your application has been installed
over an existing one.
|
static String |
ACTION_NEW_OUTGOING_CALL
Broadcast Action: An outgoing call is about to be placed.
|
static String |
ACTION_OPEN_DOCUMENT
Activity Action: Allow the user to select and return one or more existing
documents.
|
static String |
ACTION_OPEN_DOCUMENT_TREE
Activity Action: Allow the user to pick a directory subtree.
|
static String |
ACTION_PACKAGE_ADDED
Broadcast Action: A new application package has been installed on the
device.
|
static String |
ACTION_PACKAGE_CHANGED
Broadcast Action: An existing application package has been changed (for
example, a component has been enabled or disabled).
|
static String |
ACTION_PACKAGE_DATA_CLEARED
Broadcast Action: The user has cleared the data of a package.
|
static String |
ACTION_PACKAGE_FIRST_LAUNCH
Broadcast Action: Sent to the installer package of an application when
that application is first launched (that is the first time it is moved
out of the stopped state).
|
static String |
ACTION_PACKAGE_FULLY_REMOVED
Broadcast Action: An existing application package has been completely
removed from the device.
|
static String |
ACTION_PACKAGE_INSTALL
Deprecated.
This constant has never been used.
|
static String |
ACTION_PACKAGE_NEEDS_VERIFICATION
Broadcast Action: Sent to the system package verifier when a package
needs to be verified.
|
static String |
ACTION_PACKAGE_REMOVED
Broadcast Action: An existing application package has been removed from
the device.
|
static String |
ACTION_PACKAGE_REPLACED
Broadcast Action: A new version of an application package has been
installed, replacing an existing version that was previously installed.
|
static String |
ACTION_PACKAGE_RESTARTED
Broadcast Action: The user has restarted a package, and all of its
processes have been killed.
|
static String |
ACTION_PACKAGE_VERIFIED
Broadcast Action: Sent to the system package verifier when a package is
verified.
|
static String |
ACTION_PACKAGES_SUSPENDED
Broadcast Action: Packages have been suspended.
|
static String |
ACTION_PACKAGES_UNSUSPENDED
Broadcast Action: Packages have been unsuspended.
|
static String |
ACTION_PASTE
Activity Action: Create a new item in the given container, initializing it
from the current contents of the clipboard.
|
static String |
ACTION_PICK
Activity Action: Pick an item from the data, returning what was selected.
|
static String |
ACTION_PICK_ACTIVITY
Activity Action: Pick an activity given an intent, returning the class
selected.
|
static String |
ACTION_POWER_CONNECTED
Broadcast Action: External power has been connected to the device.
|
static String |
ACTION_POWER_DISCONNECTED
Broadcast Action: External power has been removed from the device.
|
static String |
ACTION_POWER_USAGE_SUMMARY
Activity Action: Show power usage information to the user.
|
static String |
ACTION_PRE_BOOT_COMPLETED
Broadcast Action: This is broadcast once when the user is booting after a
system update.
|
static String |
ACTION_PREFERRED_ACTIVITY_CHANGED
Broadcast Action: preferred activities have changed *explicitly*.
|
static String |
ACTION_PROCESS_TEXT
Activity Action: Process a piece of text.
|
static String |
ACTION_PROVIDER_CHANGED
Broadcast Action: Some content providers have parts of their namespace
where they publish new events or items that the user may be especially
interested in.
|
static String |
ACTION_QUERY_PACKAGE_RESTART |
static String |
ACTION_QUICK_CLOCK
Sent when the user taps on the clock widget in the system's "quick settings" area.
|
static String |
ACTION_QUICK_VIEW
Activity Action: Quick view the data.
|
static String |
ACTION_REBOOT
Broadcast Action: Have the device reboot.
|
static String |
ACTION_REMOTE_INTENT
Broadcast Action: a remote intent is to be broadcasted.
|
static String |
ACTION_REQUEST_SHUTDOWN
Activity Action: Start this activity to request system shutdown.
|
static String |
ACTION_RESOLVE_EPHEMERAL_PACKAGE
Service Action: Resolve ephemeral application.
|
static String |
ACTION_REVIEW_PERMISSIONS
Activity action: Launch UI to review permissions for an app.
|
static String |
ACTION_RUN
Activity Action: Run the data, whatever that means.
|
static String |
ACTION_SCREEN_OFF
Broadcast Action: Sent when the device goes to sleep and becomes non-interactive.
|
static String |
ACTION_SCREEN_ON
Broadcast Action: Sent when the device wakes up and becomes interactive.
|
static String |
ACTION_SEARCH
Activity Action: Perform a search.
|
static String |
ACTION_SEARCH_LONG_PRESS
Activity Action: Start action associated with long pressing on the
search key.
|
static String |
ACTION_SEND
Activity Action: Deliver some data to someone else.
|
static String |
ACTION_SEND_MULTIPLE
Activity Action: Deliver multiple data to someone else.
|
static String |
ACTION_SENDTO
Activity Action: Send a message to someone specified by the data.
|
static String |
ACTION_SET_WALLPAPER
Activity Action: Show settings for choosing wallpaper.
|
static String |
ACTION_SETTING_RESTORED
Broadcast action: report that a settings element is being restored from backup.
|
static String |
ACTION_SHOW_APP_INFO
Activity Action: Launch an activity showing the app information.
|
static String |
ACTION_SHOW_BRIGHTNESS_DIALOG
Activity Action: Shows the brightness setting dialog.
|
static String |
ACTION_SHOW_KEYBOARD_SHORTCUTS
Activity Action: Start the Keyboard Shortcuts Helper screen.
|
static String |
ACTION_SHUTDOWN
Broadcast Action: Device is shutting down.
|
static String |
ACTION_SIM_ACTIVATION_REQUEST
Activity action: Activate the current SIM card.
|
static String |
ACTION_SYNC
Activity Action: Perform a data synchronization.
|
static String |
ACTION_SYSTEM_TUTORIAL
Activity Action: Start the platform-defined tutorial
Input:
getStringExtra(SearchManager.QUERY)
is the text to search for. |
static String |
ACTION_THERMAL_EVENT
Broadcast action: reports when a new thermal event has been reached.
|
static String |
ACTION_TIME_CHANGED
Broadcast Action: The time was set.
|
static String |
ACTION_TIME_TICK
Broadcast Action: The current time has changed.
|
static String |
ACTION_TIMEZONE_CHANGED
Broadcast Action: The timezone has changed.
|
static String |
ACTION_UID_REMOVED
Broadcast Action: A user ID has been removed from the system.
|
static String |
ACTION_UMS_CONNECTED
Deprecated.
replaced by android.os.storage.StorageEventListener
|
static String |
ACTION_UMS_DISCONNECTED
Deprecated.
replaced by android.os.storage.StorageEventListener
|
static String |
ACTION_UNINSTALL_PACKAGE
Activity Action: Launch application uninstaller.
|
static String |
ACTION_UPGRADE_SETUP
Activity Action: Setup wizard to launch after a platform update.
|
static String |
ACTION_USER_ADDED
Broadcast sent to the system when a user is added.
|
static String |
ACTION_USER_BACKGROUND
Sent when a user switch is happening, causing the process's user to be
sent to the background.
|
static String |
ACTION_USER_FOREGROUND
Sent when a user switch is happening, causing the process's user to be
brought to the foreground.
|
static String |
ACTION_USER_INFO_CHANGED
Broadcast sent to the system when a user's information changes.
|
static String |
ACTION_USER_INITIALIZE
Sent the first time a user is starting, to allow system apps to
perform one time initialization.
|
static String |
ACTION_USER_PRESENT
Broadcast Action: Sent when the user is present after device wakes up (e.g when the
keyguard is gone).
|
static String |
ACTION_USER_REMOVED
Broadcast sent to the system when a user is removed.
|
static String |
ACTION_USER_STARTED
Broadcast sent by the system when a user is started.
|
static String |
ACTION_USER_STARTING
Broadcast sent when a user is in the process of starting.
|
static String |
ACTION_USER_STOPPED
Broadcast sent to the system when a user is stopped.
|
static String |
ACTION_USER_STOPPING
Broadcast sent when a user is going to be stopped.
|
static String |
ACTION_USER_SWITCHED
Broadcast sent to the system when the user switches.
|
static String |
ACTION_USER_UNLOCKED
Broadcast Action: Sent when the credential-encrypted private storage has
become unlocked for the target user.
|
static String |
ACTION_VIEW
Activity Action: Display the data to the user.
|
static String |
ACTION_VOICE_ASSIST
Activity Action: Perform voice assist action.
|
static String |
ACTION_VOICE_COMMAND
Activity Action: Start Voice Command.
|
static String |
ACTION_WALLPAPER_CHANGED
Deprecated.
Modern applications should use
WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER to have the wallpaper
shown behind their UI, rather than watching for this broadcast and
rendering the wallpaper on their own. |
static String |
ACTION_WEB_SEARCH
Activity Action: Perform a web search.
|
static String |
CATEGORY_ALTERNATIVE
Set if the activity should be considered as an alternative action to
the data the user is currently viewing.
|
static String |
CATEGORY_APP_BROWSER
Used with
ACTION_MAIN to launch the browser application. |
static String |
CATEGORY_APP_CALCULATOR
Used with
ACTION_MAIN to launch the calculator application. |
static String |
CATEGORY_APP_CALENDAR
Used with
ACTION_MAIN to launch the calendar application. |
static String |
CATEGORY_APP_CONTACTS
Used with
ACTION_MAIN to launch the contacts application. |
static String |
CATEGORY_APP_EMAIL
Used with
ACTION_MAIN to launch the email application. |
static String |
CATEGORY_APP_GALLERY
Used with
ACTION_MAIN to launch the gallery application. |
static String |
CATEGORY_APP_MAPS
Used with
ACTION_MAIN to launch the maps application. |
static String |
CATEGORY_APP_MARKET
This activity allows the user to browse and download new applications.
|
static String |
CATEGORY_APP_MESSAGING
Used with
ACTION_MAIN to launch the messaging application. |
static String |
CATEGORY_APP_MUSIC
Used with
ACTION_MAIN to launch the music application. |
static String |
CATEGORY_BROWSABLE
Activities that can be safely invoked from a browser must support this
category.
|
static String |
CATEGORY_CAR_DOCK
An activity to run when device is inserted into a car dock.
|
static String |
CATEGORY_CAR_MODE
Used to indicate that the activity can be used in a car environment.
|
static String |
CATEGORY_DEFAULT
Set if the activity should be an option for the default action
(center press) to perform on a piece of data.
|
static String |
CATEGORY_DESK_DOCK
An activity to run when device is inserted into a car dock.
|
static String |
CATEGORY_DEVELOPMENT_PREFERENCE
This activity is a development preference panel.
|
static String |
CATEGORY_EMBED
Capable of running inside a parent activity container.
|
static String |
CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST
To be used as code under test for framework instrumentation tests.
|
static String |
CATEGORY_HE_DESK_DOCK
An activity to run when device is inserted into a digital (high end) dock.
|
static String |
CATEGORY_HOME
This is the home activity, that is the first activity that is displayed
when the device boots.
|
static String |
CATEGORY_HOME_MAIN
This is the home activity that is displayed when the device is finished setting up and ready
for use.
|
static String |
CATEGORY_INFO
Provides information about the package it is in; typically used if
a package does not contain a
CATEGORY_LAUNCHER to provide
a front-door to the user without having to be shown in the all apps list. |
static String |
CATEGORY_LAUNCHER
Should be displayed in the top-level launcher.
|
static String |
CATEGORY_LE_DESK_DOCK
An activity to run when device is inserted into a analog (low end) dock.
|
static String |
CATEGORY_LEANBACK_LAUNCHER
Indicates an activity optimized for Leanback mode, and that should
be displayed in the Leanback launcher.
|
static String |
CATEGORY_LEANBACK_SETTINGS
Indicates a Leanback settings activity to be displayed in the Leanback launcher.
|
static String |
CATEGORY_MONKEY
This activity may be exercised by the monkey or other automated test tools.
|
static String |
CATEGORY_OPENABLE
Used to indicate that an intent only wants URIs that can be opened with
ContentResolver.openFileDescriptor(Uri, String) . |
static String |
CATEGORY_PREFERENCE
This activity is a preference panel.
|
static String |
CATEGORY_SAMPLE_CODE
To be used as a sample code example (not part of the normal user
experience).
|
static String |
CATEGORY_SELECTED_ALTERNATIVE
Set if the activity should be considered as an alternative selection
action to the data the user has currently selected.
|
static String |
CATEGORY_SETUP_WIZARD
This is the setup wizard activity, that is the first activity that is displayed
when the user sets up the device for the first time.
|
static String |
CATEGORY_TAB
Intended to be used as a tab inside of a containing TabActivity.
|
static String |
CATEGORY_TEST
To be used as a test (not part of the normal user experience).
|
static String |
CATEGORY_UNIT_TEST
To be used as a unit test (run through the Test Harness).
|
static String |
CATEGORY_VOICE
Categories for activities that can participate in voice interaction.
|
static Parcelable.Creator<Intent> |
CREATOR |
static String |
EXTRA_ALARM_COUNT
Used as an int extra field in
AlarmManager intents
to tell the application being invoked how many pending alarms are being
delievered with the intent. |
static String |
EXTRA_ALLOW_MULTIPLE
Extra used to indicate that an intent can allow the user to select and
return multiple items.
|
static String |
EXTRA_ALLOW_REPLACE
Deprecated.
As of
Build.VERSION_CODES.JELLY_BEAN , Android
will no longer show an interstitial message about updating existing
applications so this is no longer needed. |
static String |
EXTRA_ALTERNATE_INTENTS
An Intent[] describing additional, alternate choices you would like shown with
ACTION_CHOOSER . |
static String |
EXTRA_ASSIST_CONTEXT
An optional field on
ACTION_ASSIST and containing additional contextual
information supplied by the current foreground app at the time of the assist request. |
static String |
EXTRA_ASSIST_INPUT_DEVICE_ID
An optional field on
ACTION_ASSIST containing the InputDevice id
that was used to invoke the assist. |
static String |
EXTRA_ASSIST_INPUT_HINT_KEYBOARD
An optional field on
ACTION_ASSIST suggesting that the user will likely use a
keyboard as the primary input device for assistance. |
static String |
EXTRA_ASSIST_PACKAGE
An optional field on
ACTION_ASSIST containing the name of the current foreground
application package at the time the assist was invoked. |
static String |
EXTRA_ASSIST_UID
An optional field on
ACTION_ASSIST containing the uid of the current foreground
application package at the time the assist was invoked. |
static String |
EXTRA_BCC
A String[] holding e-mail addresses that should be blind carbon copied.
|
static String |
EXTRA_BUG_REPORT
Used as a parcelable extra field in
ACTION_APP_ERROR , containing
the bug report. |
static String |
EXTRA_CC
A String[] holding e-mail addresses that should be carbon copied.
|
static String |
EXTRA_CHANGED_COMPONENT_NAME
Deprecated.
See
EXTRA_CHANGED_COMPONENT_NAME_LIST ; this field
will contain only the first name in the list. |
static String |
EXTRA_CHANGED_COMPONENT_NAME_LIST
This field is part of
ACTION_PACKAGE_CHANGED ,
and contains a string array of all of the components that have changed. |
static String |
EXTRA_CHANGED_PACKAGE_LIST
This field is part of
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE ,
ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE ,
ACTION_PACKAGES_SUSPENDED ,
ACTION_PACKAGES_UNSUSPENDED
and contains a string array of all of the components that have changed. |
static String |
EXTRA_CHANGED_UID_LIST
This field is part of
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE ,
ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE
and contains an integer array of uids of all of the components
that have changed. |
static String |
EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER
An
IntentSender for an Activity that will be invoked when the user makes a selection
from the chooser activity presented by ACTION_CHOOSER . |
static String |
EXTRA_CHOOSER_TARGETS
A
ChooserTarget[] for ACTION_CHOOSER
describing additional high-priority deep-link targets for the chooser to present to the user. |
static String |
EXTRA_CHOSEN_COMPONENT
The
ComponentName chosen by the user to complete an action. |
static String |
EXTRA_CHOSEN_COMPONENT_INTENT_SENDER
An
IntentSender that will be notified if a user successfully chooses a target
component to handle an action in an ACTION_CHOOSER activity. |
static String |
EXTRA_CLIENT_INTENT |
static String |
EXTRA_CLIENT_LABEL |
static String |
EXTRA_DATA_REMOVED
Used as a boolean extra field in
ACTION_PACKAGE_REMOVED
intents to indicate whether this represents a full uninstall (removing
both the code and its data) or a partial uninstall (leaving its data,
implying that this is an update). |
static String |
EXTRA_DOCK_STATE
Used as an int extra field in
ACTION_DOCK_EVENT
intents to request the dock state. |
static int |
EXTRA_DOCK_STATE_CAR
Used as an int value for
EXTRA_DOCK_STATE
to represent that the phone is in a car dock. |
static int |
EXTRA_DOCK_STATE_DESK
Used as an int value for
EXTRA_DOCK_STATE
to represent that the phone is in a desk dock. |
static int |
EXTRA_DOCK_STATE_HE_DESK
Used as an int value for
EXTRA_DOCK_STATE
to represent that the phone is in a digital (high end) dock. |
static int |
EXTRA_DOCK_STATE_LE_DESK
Used as an int value for
EXTRA_DOCK_STATE
to represent that the phone is in a analog (low end) dock. |
static int |
EXTRA_DOCK_STATE_UNDOCKED
Used as an int value for
EXTRA_DOCK_STATE
to represent that the phone is not in any dock. |
static String |
EXTRA_DONT_KILL_APP
Used as a boolean extra field in
ACTION_PACKAGE_REMOVED or
ACTION_PACKAGE_CHANGED intents to override the default action
of restarting the application. |
static String |
EXTRA_EMAIL
A String[] holding e-mail addresses that should be delivered to.
|
static String |
EXTRA_EPHEMERAL_FAILURE
A
IntentSender to start after ephemeral installation failure. |
static String |
EXTRA_EPHEMERAL_SUCCESS
A
IntentSender to start after ephemeral installation success. |
static String |
EXTRA_EXCLUDE_COMPONENTS
A
ComponentName[] describing components that should be filtered out
and omitted from a list of components presented to the user. |
static String |
EXTRA_FORCE_MASTER_CLEAR
Boolean intent extra to be used with
ACTION_MASTER_CLEAR in order to force a factory
reset even if android.os.UserManager.DISALLOW_FACTORY_RESET is set. |
static String |
EXTRA_HTML_TEXT
A constant String that is associated with the Intent, used with
ACTION_SEND to supply an alternative to EXTRA_TEXT
as HTML formatted text. |
static String |
EXTRA_INDEX
Optional index with semantics depending on the intent action.
|
static String |
EXTRA_INITIAL_INTENTS
A Parcelable[] of
Intent or
LabeledIntent objects as set with
putExtra(String, Parcelable[]) of additional activities to place
a the front of the list of choices, when shown to the user with a
ACTION_CHOOSER . |
static String |
EXTRA_INSTALL_RESULT
Package manager install result code.
|
static String |
EXTRA_INSTALLER_PACKAGE_NAME
Used as a string extra field with
ACTION_INSTALL_PACKAGE to install a
package. |
static String |
EXTRA_INTENT
An Intent describing the choices you would like shown with
ACTION_PICK_ACTIVITY or ACTION_CHOOSER . |
static String |
EXTRA_KEY_CONFIRM
Set to true in
ACTION_REQUEST_SHUTDOWN to request confirmation from the user
before shutting down. |
static String |
EXTRA_KEY_EVENT
A
KeyEvent object containing the event that
triggered the creation of the Intent it is in. |
static String |
EXTRA_LOCAL_ONLY
Extra used to indicate that an intent should only return data that is on
the local device.
|
static String |
EXTRA_MEDIA_RESOURCE_TYPE
Used as an int extra field in
ACTION_MEDIA_RESOURCE_GRANTED
intents to specify the resource type granted. |
static int |
EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC
Used as an int value for
EXTRA_MEDIA_RESOURCE_TYPE
to represent that a audio codec is allowed to use. |
static int |
EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC
Used as an int value for
EXTRA_MEDIA_RESOURCE_TYPE
to represent that a video codec is allowed to use. |
static String |
EXTRA_MIME_TYPES
Extra used to communicate a set of acceptable MIME types.
|
static String |
EXTRA_NOT_UNKNOWN_SOURCE
Used as a boolean extra field with
ACTION_INSTALL_PACKAGE to install a
package. |
static String |
EXTRA_ORIGINATING_UID
Used as an int extra field with
ACTION_INSTALL_PACKAGE and
ACTION_VIEW to indicate the uid of the package that initiated the install |
static String |
EXTRA_ORIGINATING_URI
Used as a URI extra field with
ACTION_INSTALL_PACKAGE and
ACTION_VIEW to indicate the URI from which the local APK in the Intent
data field originated from. |
static String |
EXTRA_PACKAGE_NAME
Intent extra: An app package name.
|
static String |
EXTRA_PACKAGES |
static String |
EXTRA_PERMISSION_NAME
Intent extra: The name of a permission.
|
static String |
EXTRA_PHONE_NUMBER
A String holding the phone number originally entered in
ACTION_NEW_OUTGOING_CALL , or the actual
number to call in a ACTION_CALL . |
static String |
EXTRA_PROCESS_TEXT
The name of the extra used to define the text to be processed, as a
CharSequence.
|
static String |
EXTRA_PROCESS_TEXT_READONLY
The name of the boolean extra used to define if the processed text will be used as read-only.
|
static String |
EXTRA_QUIET_MODE
Optional boolean extra indicating whether quiet mode has been switched on or off.
|
static String |
EXTRA_REASON |
static String |
EXTRA_REFERRER
This extra can be used with any Intent used to launch an activity, supplying information
about who is launching that activity.
|
static String |
EXTRA_REFERRER_NAME
Alternate version of
EXTRA_REFERRER that supplies the URI as a String rather
than a Uri object. |
static String |
EXTRA_REMOTE_CALLBACK
Intent extra: A callback for reporting remote result as a bundle.
|
static String |
EXTRA_REMOTE_INTENT_TOKEN
Used in the extra field in the remote intent.
|
static String |
EXTRA_REMOVED_FOR_ALL_USERS |
static String |
EXTRA_REPLACEMENT_EXTRAS
A Bundle forming a mapping of potential target package names to different extras Bundles
to add to the default intent extras in
EXTRA_INTENT when used with
ACTION_CHOOSER . |
static String |
EXTRA_REPLACING
Used as a boolean extra field in
ACTION_PACKAGE_REMOVED
intents to indicate that this is a replacement of the package, so this
broadcast will immediately be followed by an add broadcast for a
different version of the same package. |
static String |
EXTRA_RESTRICTIONS_BUNDLE
Extra sent in the intent to the BroadcastReceiver that handles
ACTION_GET_RESTRICTION_ENTRIES . |
static String |
EXTRA_RESTRICTIONS_INTENT
Extra used in the response from a BroadcastReceiver that handles
ACTION_GET_RESTRICTION_ENTRIES . |
static String |
EXTRA_RESTRICTIONS_LIST
Extra used in the response from a BroadcastReceiver that handles
ACTION_GET_RESTRICTION_ENTRIES . |
static String |
EXTRA_RESULT_NEEDED
Intent extra: An extra for specifying whether a result is needed.
|
static String |
EXTRA_RESULT_RECEIVER
A
ResultReceiver used to return data back to the sender. |
static String |
EXTRA_RETURN_RESULT
Used as a boolean extra field with
ACTION_INSTALL_PACKAGE or
ACTION_UNINSTALL_PACKAGE . |
static String |
EXTRA_SETTING_NAME |
static String |
EXTRA_SETTING_NEW_VALUE |
static String |
EXTRA_SETTING_PREVIOUS_VALUE |
static String |
EXTRA_SHORTCUT_ICON
The name of the extra used to define the icon, as a Bitmap, of a shortcut.
|
static String |
EXTRA_SHORTCUT_ICON_RESOURCE
The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut.
|
static String |
EXTRA_SHORTCUT_INTENT
The name of the extra used to define the Intent of a shortcut.
|
static String |
EXTRA_SHORTCUT_NAME
The name of the extra used to define the name of a shortcut.
|
static String |
EXTRA_SHUTDOWN_USERSPACE_ONLY
Optional extra for
ACTION_SHUTDOWN that allows the sender to qualify that
this shutdown is only for the user space of the system, not a complete shutdown. |
static String |
EXTRA_SIM_ACTIVATION_RESPONSE
Optional
PendingIntent extra used to deliver the result of the SIM
activation request. |
static String |
EXTRA_STREAM
A content: URI holding a stream of data associated with the Intent,
used with
ACTION_SEND to supply the data being sent. |
static String |
EXTRA_SUBJECT
A constant string holding the desired subject line of a message.
|
static String |
EXTRA_TASK_ID
An int representing the task id to be retrieved.
|
static String |
EXTRA_TEMPLATE
The initial data to place in a newly created record.
|
static String |
EXTRA_TEXT
A constant CharSequence that is associated with the Intent, used with
ACTION_SEND to supply the literal data to be sent. |
static String |
EXTRA_THERMAL_STATE |
static int |
EXTRA_THERMAL_STATE_EXCEEDED
Thermal state where the device has reached its maximum threshold.
|
static int |
EXTRA_THERMAL_STATE_NORMAL
Thermal state when the device is normal.
|
static int |
EXTRA_THERMAL_STATE_WARNING
Thermal state where the device is approaching its maximum threshold.
|
static String |
EXTRA_TIME_PREF_24_HOUR_FORMAT
Optional boolean extra for
ACTION_TIME_CHANGED that indicates the
user has set their time format preferences to the 24 hour format. |
static String |
EXTRA_TITLE
A CharSequence dialog title to provide to the user when used with a
ACTION_CHOOSER . |
static String |
EXTRA_UID
Used as an int extra field in
ACTION_UID_REMOVED
intents to supply the uid the package had been assigned. |
static String |
EXTRA_UNINSTALL_ALL_USERS
Specify whether the package should be uninstalled for all users.
|
static String |
EXTRA_USER
The UserHandle carried with broadcasts intents related to addition and removal of managed
profiles -
ACTION_MANAGED_PROFILE_ADDED and ACTION_MANAGED_PROFILE_REMOVED . |
static String |
EXTRA_USER_HANDLE
The integer userHandle carried with broadcast intents related to addition, removal and
switching of users and managed profiles -
ACTION_USER_ADDED ,
ACTION_USER_REMOVED and ACTION_USER_SWITCHED . |
static String |
EXTRA_USER_ID
An int representing the user id to be used.
|
static String |
EXTRA_USER_REQUESTED_SHUTDOWN
Set to true in
ACTION_REQUEST_SHUTDOWN to indicate that the shutdown is
requested by the user. |
static String |
EXTRA_WIPE_EXTERNAL_STORAGE |
static int |
FILL_IN_ACTION
Use with
fillIn(android.content.Intent, int) to allow the current action value to be
overwritten, even if it is already set. |
static int |
FILL_IN_CATEGORIES
Use with
fillIn(android.content.Intent, int) to allow the current categories to be
overwritten, even if they are already set. |
static int |
FILL_IN_CLIP_DATA
Use with
fillIn(android.content.Intent, int) to allow the current ClipData to be
overwritten, even if it is already set. |
static int |
FILL_IN_COMPONENT
Use with
fillIn(android.content.Intent, int) to allow the current component value to be
overwritten, even if it is already set. |
static int |
FILL_IN_DATA
Use with
fillIn(android.content.Intent, int) to allow the current data or type value
overwritten, even if it is already set. |
static int |
FILL_IN_PACKAGE
Use with
fillIn(android.content.Intent, int) to allow the current package value to be
overwritten, even if it is already set. |
static int |
FILL_IN_SELECTOR
Use with
fillIn(android.content.Intent, int) to allow the current selector to be
overwritten, even if it is already set. |
static int |
FILL_IN_SOURCE_BOUNDS
Use with
fillIn(android.content.Intent, int) to allow the current bounds rectangle to be
overwritten, even if it is already set. |
static int |
FLAG_ACTIVITY_BROUGHT_TO_FRONT
This flag is not normally set by application code, but set for you by
the system as described in the
launchMode documentation for the singleTask mode. |
static int |
FLAG_ACTIVITY_CLEAR_TASK
If set in an Intent passed to
Context.startActivity() ,
this flag will cause any existing task that would be associated with the
activity to be cleared before the activity is started. |
static int |
FLAG_ACTIVITY_CLEAR_TOP
If set, and the activity being launched is already running in the
current task, then instead of launching a new instance of that activity,
all of the other activities on top of it will be closed and this Intent
will be delivered to the (now on top) old activity as a new Intent.
|
static int |
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
Deprecated.
As of API 21 this performs identically to
FLAG_ACTIVITY_NEW_DOCUMENT which should be used instead of this. |
static int |
FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
If set, the new activity is not kept in the list of recently launched
activities.
|
static int |
FLAG_ACTIVITY_FORWARD_RESULT
If set and this intent is being used to launch a new activity from an
existing one, then the reply target of the existing activity will be
transfered to the new activity.
|
static int |
FLAG_ACTIVITY_LAUNCH_ADJACENT
This flag is only used in split-screen multi-window mode.
|
static int |
FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
This flag is not normally set by application code, but set for you by
the system if this activity is being launched from history
(longpress home key).
|
static int |
FLAG_ACTIVITY_MULTIPLE_TASK
This flag is used to create a new task and launch an activity into it.
|
static int |
FLAG_ACTIVITY_NEW_DOCUMENT
This flag is used to open a document into a new task rooted at the activity launched
by this Intent.
|
static int |
FLAG_ACTIVITY_NEW_TASK
If set, this activity will become the start of a new task on this
history stack.
|
static int |
FLAG_ACTIVITY_NO_ANIMATION
If set in an Intent passed to
Context.startActivity() ,
this flag will prevent the system from applying an activity transition
animation to go to the next activity state. |
static int |
FLAG_ACTIVITY_NO_HISTORY
If set, the new activity is not kept in the history stack.
|
static int |
FLAG_ACTIVITY_NO_USER_ACTION
If set, this flag will prevent the normal
Activity.onUserLeaveHint()
callback from occurring on the current frontmost activity before it is
paused as the newly-started activity is brought to the front. |
static int |
FLAG_ACTIVITY_PREVIOUS_IS_TOP
If set and this intent is being used to launch a new activity from an
existing one, the current activity will not be counted as the top
activity for deciding whether the new intent should be delivered to
the top instead of starting a new one.
|
static int |
FLAG_ACTIVITY_REORDER_TO_FRONT
If set in an Intent passed to
Context.startActivity() ,
this flag will cause the launched activity to be brought to the front of its
task's history stack if it is already running. |
static int |
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
If set, and this activity is either being started in a new task or
bringing to the top an existing task, then it will be launched as
the front door of the task.
|
static int |
FLAG_ACTIVITY_RETAIN_IN_RECENTS
By default a document created by
FLAG_ACTIVITY_NEW_DOCUMENT will
have its entry in recent tasks removed when the user closes it (with back
or however else it may finish()). |
static int |
FLAG_ACTIVITY_SINGLE_TOP
If set, the activity will not be launched if it is already running
at the top of the history stack.
|
static int |
FLAG_ACTIVITY_TASK_ON_HOME
If set in an Intent passed to
Context.startActivity() ,
this flag will cause a newly launching task to be placed on top of the current
home activity task (if there is one). |
static int |
FLAG_DEBUG_LOG_RESOLUTION
A flag you can enable for debugging: when set, log messages will be
printed during the resolution of this intent to show you what has
been found to create the final resolved list.
|
static int |
FLAG_DEBUG_TRIAGED_MISSING
Internal flag used to indicate that a system component has done their
homework and verified that they correctly handle packages and components
that come and go over time.
|
static int |
FLAG_EXCLUDE_STOPPED_PACKAGES
If set, this intent will not match any components in packages that
are currently stopped.
|
static int |
FLAG_FROM_BACKGROUND
Can be set by the caller to indicate that this Intent is coming from
a background operation, not from direct user interaction.
|
static int |
FLAG_GRANT_PERSISTABLE_URI_PERMISSION
When combined with
FLAG_GRANT_READ_URI_PERMISSION and/or
FLAG_GRANT_WRITE_URI_PERMISSION , the URI permission grant can be
persisted across device reboots until explicitly revoked with
Context.revokeUriPermission(Uri, int) . |
static int |
FLAG_GRANT_PREFIX_URI_PERMISSION
When combined with
FLAG_GRANT_READ_URI_PERMISSION and/or
FLAG_GRANT_WRITE_URI_PERMISSION , the URI permission grant
applies to any URI that is a prefix match against the original granted
URI. |
static int |
FLAG_GRANT_READ_URI_PERMISSION
If set, the recipient of this Intent will be granted permission to
perform read operations on the URI in the Intent's data and any URIs
specified in its ClipData.
|
static int |
FLAG_GRANT_WRITE_URI_PERMISSION
If set, the recipient of this Intent will be granted permission to
perform write operations on the URI in the Intent's data and any URIs
specified in its ClipData.
|
static int |
FLAG_IGNORE_EPHEMERAL
Internal flag used to indicate ephemeral applications should not be
considered when resolving the intent.
|
static int |
FLAG_INCLUDE_STOPPED_PACKAGES
If set, this intent will always match any components in packages that
are currently stopped.
|
static int |
FLAG_RECEIVER_BOOT_UPGRADE
Set when this broadcast is for a boot upgrade, a special mode that
allows the broadcast to be sent before the system is ready and launches
the app process with no providers running in it.
|
static int |
FLAG_RECEIVER_EXCLUDE_BACKGROUND
If set, the broadcast will never go to manifest receivers in background (cached
or not running) apps, regardless of whether that would be done by default.
|
static int |
FLAG_RECEIVER_FOREGROUND
If set, when sending a broadcast the recipient is allowed to run at
foreground priority, with a shorter timeout interval.
|
static int |
FLAG_RECEIVER_INCLUDE_BACKGROUND
If set, the broadcast will always go to manifest receivers in background (cached
or not running) apps, regardless of whether that would be done by default.
|
static int |
FLAG_RECEIVER_NO_ABORT
If this is an ordered broadcast, don't allow receivers to abort the broadcast.
|
static int |
FLAG_RECEIVER_REGISTERED_ONLY
If set, when sending a broadcast only registered receivers will be
called -- no BroadcastReceiver components will be launched.
|
static int |
FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
If set, when sending a broadcast before boot has completed only
registered receivers will be called -- no BroadcastReceiver components
will be launched.
|
static int |
FLAG_RECEIVER_REPLACE_PENDING
If set, when sending a broadcast the new broadcast will replace
any existing pending broadcast that matches it.
|
static int |
IMMUTABLE_FLAGS |
static String |
METADATA_DOCK_HOME
Boolean that can be supplied as meta-data with a dock activity, to
indicate that the dock should take over the home key when it is active.
|
static String |
METADATA_SETUP_VERSION
A string associated with a
ACTION_UPGRADE_SETUP activity
describing the last run version of the platform that was setup. |
static int |
URI_ALLOW_UNSAFE
Flag for use with
toUri(int) and parseUri(java.lang.String, int) : allow parsing
of unsafe information. |
static int |
URI_ANDROID_APP_SCHEME
Flag for use with
toUri(int) and parseUri(java.lang.String, int) : the URI string
always has the "android-app:" scheme. |
static int |
URI_INTENT_SCHEME
Flag for use with
toUri(int) and parseUri(java.lang.String, int) : the URI string
always has the "intent:" scheme. |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Modifier | Constructor and Description |
---|---|
|
Intent()
Create an empty intent.
|
|
Intent(Context packageContext,
Class<?> cls)
Create an intent for a specific component.
|
|
Intent(Intent o)
Copy constructor.
|
protected |
Intent(Parcel in) |
|
Intent(String action)
Create an intent with a given action.
|
|
Intent(String action,
Uri uri)
Create an intent with a given action and for a given data url.
|
|
Intent(String action,
Uri uri,
Context packageContext,
Class<?> cls)
Create an intent for a specific component with a specified action and data.
|
Modifier and Type | Method and Description |
---|---|
Intent |
addCategory(String category)
Add a new category to the intent.
|
Intent |
addFlags(int flags)
Add additional flags to the intent (or with existing flags
value).
|
Object |
clone()
Creates and returns a copy of this object.
|
Intent |
cloneFilter()
Make a clone of only the parts of the Intent that are relevant for
filter matching: the action, data, type, component, and categories.
|
static Intent |
createChooser(Intent target,
CharSequence title)
Convenience function for creating a
ACTION_CHOOSER Intent. |
static Intent |
createChooser(Intent target,
CharSequence title,
IntentSender sender)
Convenience function for creating a
ACTION_CHOOSER Intent. |
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
int |
fillIn(Intent other,
int flags)
Copy the contents of other in to this object, but only
where fields are not defined by this object.
|
boolean |
filterEquals(Intent other)
Determine if two intents are the same for the purposes of intent
resolution (filtering).
|
int |
filterHashCode()
Generate hash code that matches semantics of filterEquals().
|
void |
fixUris(int contentUserHint) |
String |
getAction()
Retrieve the general action to be performed, such as
ACTION_VIEW . |
boolean[] |
getBooleanArrayExtra(String name)
Retrieve extended data from the intent.
|
boolean |
getBooleanExtra(String name,
boolean defaultValue)
Retrieve extended data from the intent.
|
Bundle |
getBundleExtra(String name)
Retrieve extended data from the intent.
|
byte[] |
getByteArrayExtra(String name)
Retrieve extended data from the intent.
|
byte |
getByteExtra(String name,
byte defaultValue)
Retrieve extended data from the intent.
|
Set<String> |
getCategories()
Return the set of all categories in the intent.
|
char[] |
getCharArrayExtra(String name)
Retrieve extended data from the intent.
|
char |
getCharExtra(String name,
char defaultValue)
Retrieve extended data from the intent.
|
CharSequence[] |
getCharSequenceArrayExtra(String name)
Retrieve extended data from the intent.
|
ArrayList<CharSequence> |
getCharSequenceArrayListExtra(String name)
Retrieve extended data from the intent.
|
CharSequence |
getCharSequenceExtra(String name)
Retrieve extended data from the intent.
|
ClipData |
getClipData()
Return the
ClipData associated with this Intent. |
ComponentName |
getComponent()
Retrieve the concrete component associated with the intent.
|
int |
getContentUserHint() |
Uri |
getData()
Retrieve data this intent is operating on.
|
String |
getDataString()
The same as
getData() , but returns the URI as an encoded
String. |
double[] |
getDoubleArrayExtra(String name)
Retrieve extended data from the intent.
|
double |
getDoubleExtra(String name,
double defaultValue)
Retrieve extended data from the intent.
|
Object |
getExtra(String name)
Deprecated.
|
Object |
getExtra(String name,
Object defaultValue)
Deprecated.
|
Bundle |
getExtras()
Retrieves a map of extended data from the intent.
|
int |
getFlags()
Retrieve any special flags associated with this intent.
|
float[] |
getFloatArrayExtra(String name)
Retrieve extended data from the intent.
|
float |
getFloatExtra(String name,
float defaultValue)
Retrieve extended data from the intent.
|
IBinder |
getIBinderExtra(String name)
Deprecated.
|
int[] |
getIntArrayExtra(String name)
Retrieve extended data from the intent.
|
ArrayList<Integer> |
getIntegerArrayListExtra(String name)
Retrieve extended data from the intent.
|
static Intent |
getIntent(String uri)
Deprecated.
Use
parseUri(java.lang.String, int) instead. |
static Intent |
getIntentOld(String uri) |
int |
getIntExtra(String name,
int defaultValue)
Retrieve extended data from the intent.
|
long[] |
getLongArrayExtra(String name)
Retrieve extended data from the intent.
|
long |
getLongExtra(String name,
long defaultValue)
Retrieve extended data from the intent.
|
String |
getPackage()
Retrieve the application package name this Intent is limited to.
|
Parcelable[] |
getParcelableArrayExtra(String name)
Retrieve extended data from the intent.
|
<T extends Parcelable> |
getParcelableArrayListExtra(String name)
Retrieve extended data from the intent.
|
<T extends Parcelable> |
getParcelableExtra(String name)
Retrieve extended data from the intent.
|
String |
getScheme()
Return the scheme portion of the intent's data.
|
Intent |
getSelector()
Return the specific selector associated with this Intent.
|
Serializable |
getSerializableExtra(String name)
Retrieve extended data from the intent.
|
short[] |
getShortArrayExtra(String name)
Retrieve extended data from the intent.
|
short |
getShortExtra(String name,
short defaultValue)
Retrieve extended data from the intent.
|
Rect |
getSourceBounds()
Get the bounds of the sender of this intent, in screen coordinates.
|
String[] |
getStringArrayExtra(String name)
Retrieve extended data from the intent.
|
ArrayList<String> |
getStringArrayListExtra(String name)
Retrieve extended data from the intent.
|
String |
getStringExtra(String name)
Retrieve extended data from the intent.
|
String |
getType()
Retrieve any explicit MIME type included in the intent.
|
boolean |
hasCategory(String category)
Check if a category exists in the intent.
|
boolean |
hasExtra(String name)
Returns true if an extra value is associated with the given name.
|
boolean |
hasFileDescriptors()
Returns true if the Intent's extras contain a parcelled file descriptor.
|
static boolean |
isAccessUriMode(int modeFlags)
Test if given mode flags specify an access mode, which must be at least
read and/or write.
|
boolean |
isDocument() |
boolean |
isExcludingStopped() |
static Intent |
makeMainActivity(ComponentName mainActivity)
Create an intent to launch the main (root) activity of a task.
|
static Intent |
makeMainSelectorActivity(String selectorAction,
String selectorCategory)
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.
|
static Intent |
makeRestartActivityTask(ComponentName mainActivity)
Make an Intent that can be used to re-launch an application's task
in its base state.
|
boolean |
migrateExtraStreamToClipData()
|
static String |
normalizeMimeType(String type)
Normalize a MIME data type.
|
static Intent |
parseCommandArgs(ShellCommand cmd,
Intent.CommandOptionHandler optionHandler) |
static Intent |
parseIntent(Resources resources,
XmlPullParser parser,
AttributeSet attrs)
Parses the "intent" element (and its children) from XML and instantiates
an Intent object.
|
static Intent |
parseUri(String uri,
int flags)
Create an intent from a URI.
|
void |
prepareToEnterProcess() |
void |
prepareToLeaveProcess(boolean leavingPackage)
Prepare this
Intent to leave an app process. |
void |
prepareToLeaveProcess(Context context)
Prepare this
Intent to leave an app process. |
void |
prepareToLeaveUser(int userId)
This is NOT a secure mechanism to identify the user who sent the intent.
|
static void |
printIntentArgsHelp(PrintWriter pw,
String prefix) |
Intent |
putCharSequenceArrayListExtra(String name,
ArrayList<CharSequence> value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
boolean value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
boolean[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
Bundle value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
byte value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
byte[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
char value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
char[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
CharSequence value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
CharSequence[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
double value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
double[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
float value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
float[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
IBinder value)
Deprecated.
|
Intent |
putExtra(String name,
int value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
int[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
long value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
long[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
Parcelable value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
Parcelable[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
Serializable value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
short value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
short[] value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
String value)
Add extended data to the intent.
|
Intent |
putExtra(String name,
String[] value)
Add extended data to the intent.
|
Intent |
putExtras(Bundle extras)
Add a set of extended data to the intent.
|
Intent |
putExtras(Intent src)
Copy all extras in 'src' in to this intent.
|
Intent |
putIntegerArrayListExtra(String name,
ArrayList<Integer> value)
Add extended data to the intent.
|
Intent |
putParcelableArrayListExtra(String name,
ArrayList<? extends Parcelable> value)
Add extended data to the intent.
|
Intent |
putStringArrayListExtra(String name,
ArrayList<String> value)
Add extended data to the intent.
|
void |
readFromParcel(Parcel in) |
void |
removeCategory(String category)
Remove a category from an intent.
|
void |
removeExtra(String name)
Remove extended data from the intent.
|
void |
removeUnsafeExtras()
Filter extras to only basic types.
|
Intent |
replaceExtras(Bundle extras)
Completely replace the extras in the Intent with the given Bundle of
extras.
|
Intent |
replaceExtras(Intent src)
Completely replace the extras in the Intent with the extras in the
given Intent.
|
ComponentName |
resolveActivity(PackageManager pm)
Return the Activity component that should be used to handle this intent.
|
ActivityInfo |
resolveActivityInfo(PackageManager pm,
int flags)
Resolve the Intent into an
ActivityInfo
describing the activity that should execute the intent. |
ComponentName |
resolveSystemService(PackageManager pm,
int flags)
Special function for use by the system to resolve service
intents to system apps.
|
String |
resolveType(ContentResolver resolver)
Return the MIME data type of this intent.
|
String |
resolveType(Context context)
Return the MIME data type of this intent.
|
String |
resolveTypeIfNeeded(ContentResolver resolver)
Return the MIME data type of this intent, only if it will be needed for
intent resolution.
|
static Intent |
restoreFromXml(XmlPullParser in) |
void |
saveToXml(XmlSerializer out) |
Intent |
setAction(String action)
Set the general action to be performed.
|
void |
setAllowFds(boolean allowFds) |
Intent |
setClass(Context packageContext,
Class<?> cls)
Convenience for calling
setComponent(ComponentName) with the
name returned by a Class object. |
Intent |
setClassName(Context packageContext,
String className)
Convenience for calling
setComponent(android.content.ComponentName) with an
explicit class name. |
Intent |
setClassName(String packageName,
String className)
Convenience for calling
setComponent(android.content.ComponentName) with an
explicit application package name and class name. |
void |
setClipData(ClipData clip)
Set a
ClipData associated with this Intent. |
Intent |
setComponent(ComponentName component)
(Usually optional) Explicitly set the component to handle the intent.
|
Intent |
setData(Uri data)
Set the data this intent is operating on.
|
Intent |
setDataAndNormalize(Uri data)
Normalize and set the data this intent is operating on.
|
Intent |
setDataAndType(Uri data,
String type)
(Usually optional) Set the data for the intent along with an explicit
MIME data type.
|
Intent |
setDataAndTypeAndNormalize(Uri data,
String type)
(Usually optional) Normalize and set both the data Uri and an explicit
MIME data type.
|
void |
setDefusable(boolean defusable) |
void |
setExtrasClassLoader(ClassLoader loader)
Sets the ClassLoader that will be used when unmarshalling
any Parcelable values from the extras of this Intent.
|
Intent |
setFlags(int flags)
Set special flags controlling how this intent is handled.
|
Intent |
setPackage(String packageName)
(Usually optional) Set an explicit application package name that limits
the components this Intent will resolve to.
|
void |
setSelector(Intent selector)
Set a selector for this Intent.
|
void |
setSourceBounds(Rect r)
Set the bounds of the sender of this intent, in screen coordinates.
|
Intent |
setType(String type)
Set an explicit MIME data type.
|
Intent |
setTypeAndNormalize(String type)
Normalize and set an explicit MIME data type.
|
String |
toInsecureString() |
String |
toInsecureStringWithClip() |
String |
toShortString(boolean secure,
boolean comp,
boolean extras,
boolean clip) |
void |
toShortString(StringBuilder b,
boolean secure,
boolean comp,
boolean extras,
boolean clip) |
String |
toString()
Returns a string representation of the object.
|
String |
toURI()
Deprecated.
Use
toUri(int) instead. |
String |
toUri(int flags)
Convert this Intent into a String holding a URI representation of it.
|
void |
writeToParcel(Parcel out,
int flags)
Flatten this object in to a Parcel.
|
public static final String ACTION_MAIN
Input: nothing
Output: nothing
public static final String ACTION_VIEW
Input: getData()
is URI from which to retrieve data.
Output: nothing.
public static final String ACTION_DEFAULT
ACTION_VIEW
, the "standard" action that is
performed on a piece of data.public static final String ACTION_QUICK_VIEW
Activities handling this intent action should handle the vast majority of MIME types rather than only specific ones.
Input: getData()
is a mandatory content URI of the item to
preview. getClipData()
contains an optional list of content URIs
if there is more than one item to preview. EXTRA_INDEX
is an
optional index of the URI in the clip data to show first.
Output: nothing.
public static final String ACTION_ATTACH_DATA
Input: getData()
is URI of data to be attached.
Output: nothing.
public static final String ACTION_EDIT
Input: getData()
is URI of data to be edited.
Output: nothing.
public static final String ACTION_INSERT_OR_EDIT
Input: getType()
is the desired MIME type of the item to create or edit.
The extras can contain type specific data to pass through to the editing/creating
activity.
Output: The URI of the item that was picked. This must be a content: URI so that any receiver can access it.
public static final String ACTION_PICK
Input: getData()
is URI containing a directory of data
(vnd.android.cursor.dir/*) from which to pick an item.
Output: The URI of the item that was picked.
public static final String ACTION_CREATE_SHORTCUT
Input: Nothing.
Output: An Intent representing the shortcut. The intent must contain three extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE (value: ShortcutIconResource).
public static final String EXTRA_SHORTCUT_INTENT
ACTION_CREATE_SHORTCUT
,
Constant Field Valuespublic static final String EXTRA_SHORTCUT_NAME
ACTION_CREATE_SHORTCUT
,
Constant Field Valuespublic static final String EXTRA_SHORTCUT_ICON
ACTION_CREATE_SHORTCUT
,
Constant Field Valuespublic static final String EXTRA_SHORTCUT_ICON_RESOURCE
public static final String ACTION_APPLICATION_PREFERENCES
public static final String ACTION_SHOW_APP_INFO
Input: EXTRA_PACKAGE_NAME
specifies the package whose information needs
to be displayed.
Output: Nothing.
public static final String ACTION_CHOOSER
This action should be used when the user will naturally expect to select an activity in order to proceed. An example if when not to use it is when the user clicks on a "mailto:" link. They would naturally expect to go directly to their mail app, so startActivity() should be called directly: it will either launch the current preferred app, or put up a dialog allowing the user to pick an app to use and optionally marking that as preferred.
In contrast, if the user is selecting a menu item to send a picture they are viewing to someone else, there are many different things they may want to do at this point: send it through e-mail, upload it to a web service, etc. In this case the CHOOSER action should be used, to always present to the user a list of the things they can do, with a nice title given by the caller such as "Send this photo with:".
If you need to grant URI permissions through a chooser, you must specify
the permissions to be granted on the ACTION_CHOOSER Intent
in addition to the EXTRA_INTENT inside. This means using
setClipData(android.content.ClipData)
to specify the URIs to be granted as well as
FLAG_GRANT_READ_URI_PERMISSION
and/or
FLAG_GRANT_WRITE_URI_PERMISSION
as appropriate.
As a convenience, an Intent of this form can be created with the
createChooser(android.content.Intent, java.lang.CharSequence)
function.
Input: No data should be specified. get*Extra must have
a EXTRA_INTENT
field containing the Intent being executed,
and can optionally have a EXTRA_TITLE
field containing the
title text to display in the chooser.
Output: Depends on the protocol of EXTRA_INTENT
.
public static final String ACTION_GET_CONTENT
ACTION_PICK
in that here we
just say what kind of data is desired, not a URI of existing data from
which the user can pick. An ACTION_GET_CONTENT could allow the user to
create the data as it runs (for example taking a picture or recording a
sound), let them browse over the web and download the desired data,
etc.
There are two main ways to use this action: if you want a specific kind
of data, such as a person contact, you set the MIME type to the kind of
data you want and launch it with Context.startActivity(Intent)
.
The system will then launch the best application to select that kind
of data for you.
You may also be interested in any of a set of types of content the user can pick. For example, an e-mail application that wants to allow the user to add an attachment to an e-mail message can use this action to bring up a list of all of the types of content the user can attach.
In this case, you should wrap the GET_CONTENT intent with a chooser
(through createChooser(android.content.Intent, java.lang.CharSequence)
), which will give the proper interface
for the user to pick how to send your data and allow you to specify
a prompt indicating what they are doing. You will usually specify a
broad MIME type (such as image/* or */*), resulting in a
broad range of content types the user can select from.
When using such a broad GET_CONTENT action, it is often desirable to
only pick from data that can be represented as a stream. This is
accomplished by requiring the CATEGORY_OPENABLE
in the Intent.
Callers can optionally specify EXTRA_LOCAL_ONLY
to request that
the launched content chooser only returns results representing data that
is locally available on the device. For example, if this extra is set
to true then an image picker should not show any pictures that are available
from a remote server but not already on the local device (thus requiring
they be downloaded when opened).
If the caller can handle multiple returned items (the user performing
multiple selection), then it can specify EXTRA_ALLOW_MULTIPLE
to indicate this.
Input: getType()
is the desired MIME type to retrieve. Note
that no URI is supplied in the intent, as there are no constraints on
where the returned data originally comes from. You may also include the
CATEGORY_OPENABLE
if you can only accept data that can be
opened as a stream. You may use EXTRA_LOCAL_ONLY
to limit content
selection to local data. You may use EXTRA_ALLOW_MULTIPLE
to
allow the user to select multiple items.
Output: The URI of the item that was picked. This must be a content: URI so that any receiver can access it.
public static final String ACTION_DIAL
Input: If nothing, an empty dialer is started; else getData()
is URI of a phone number to be dialed or a tel: URI of an explicit phone
number.
Output: nothing.
public static final String ACTION_CALL
Input: If nothing, an empty dialer is started; else getData()
is URI of a phone number to be dialed or a tel: URI of an explicit phone
number.
Output: nothing.
Note: there will be restrictions on which applications can initiate a
call; most applications should use the ACTION_DIAL
.
Note: this Intent cannot be used to call emergency
numbers. Applications can dial emergency numbers using
ACTION_DIAL
, however.
Note: if you app targets M
and above and declares as using the android.Manifest.permission#CALL_PHONE
permission which is not granted, then attempting to use this action will
result in a SecurityException
.
public static final String ACTION_CALL_EMERGENCY
Input: getData()
is URI of a phone number to be dialed or a
tel: URI of an explicit phone number.
Output: nothing.
public static final String ACTION_CALL_PRIVILEGED
Input: getData()
is URI of a phone number to be dialed or a
tel: URI of an explicit phone number.
Output: nothing.
public static final String ACTION_SIM_ACTIVATION_REQUEST
Input: No data should be specified. get*Extra may have an optional
EXTRA_SIM_ACTIVATION_RESPONSE
field containing a PendingIntent through which to
send the activation result.
Output: nothing.
public static final String ACTION_SENDTO
Input: getData()
is URI describing the target.
Output: nothing.
public static final String ACTION_SEND
When launching a SEND intent, you should usually wrap it in a chooser
(through createChooser(android.content.Intent, java.lang.CharSequence)
), which will give the proper interface
for the user to pick how to send your data and allow you to specify
a prompt indicating what they are doing.
Input: getType()
is the MIME type of the data being sent.
get*Extra can have either a EXTRA_TEXT
or EXTRA_STREAM
field, containing the data to be sent. If
using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it
should be the MIME type of the data in EXTRA_STREAM. Use */*
if the MIME type is unknown (this will only allow senders that can
handle generic data streams). If using EXTRA_TEXT
, you can
also optionally supply EXTRA_HTML_TEXT
for clients to retrieve
your text with HTML formatting.
As of Build.VERSION_CODES.JELLY_BEAN
, the data
being sent can be supplied through setClipData(ClipData)
. This
allows you to use FLAG_GRANT_READ_URI_PERMISSION
when sharing
content: URIs and other advanced features of ClipData
. If
using this approach, you still must supply the same data through the
EXTRA_TEXT
or EXTRA_STREAM
fields described below
for compatibility with old applications. If you don't set a ClipData,
it will be copied there for you when calling Context.startActivity(Intent)
.
Optional standard extras, which may be interpreted by some recipients as
appropriate, are: EXTRA_EMAIL
, EXTRA_CC
,
EXTRA_BCC
, EXTRA_SUBJECT
.
Output: nothing.
public static final String ACTION_SEND_MULTIPLE
Like ACTION_SEND
, except the data is multiple.
Input: getType()
is the MIME type of the data being sent.
get*ArrayListExtra can have either a EXTRA_TEXT
or EXTRA_STREAM
field, containing the data to be sent. If using
EXTRA_TEXT
, you can also optionally supply EXTRA_HTML_TEXT
for clients to retrieve your text with HTML formatting.
Multiple types are supported, and receivers should handle mixed types whenever possible. The right way for the receiver to check them is to use the content resolver on each URI. The intent sender should try to put the most concrete mime type in the intent type, but it can fall back to <type>/* or */* as needed.
e.g. if you are sending image/jpg and image/jpg, the intent's type can be image/jpg, but if you are sending image/jpg and image/png, then the intent's type should be image/*.
As of Build.VERSION_CODES.JELLY_BEAN
, the data
being sent can be supplied through setClipData(ClipData)
. This
allows you to use FLAG_GRANT_READ_URI_PERMISSION
when sharing
content: URIs and other advanced features of ClipData
. If
using this approach, you still must supply the same data through the
EXTRA_TEXT
or EXTRA_STREAM
fields described below
for compatibility with old applications. If you don't set a ClipData,
it will be copied there for you when calling Context.startActivity(Intent)
.
Optional standard extras, which may be interpreted by some recipients as
appropriate, are: EXTRA_EMAIL
, EXTRA_CC
,
EXTRA_BCC
, EXTRA_SUBJECT
.
Output: nothing.
public static final String ACTION_ANSWER
Input: nothing.
Output: nothing.
public static final String ACTION_INSERT
Input: getData()
is URI of the directory (vnd.android.cursor.dir/*)
in which to place the data.
Output: URI of the new data that was created.
public static final String ACTION_PASTE
Input: getData()
is URI of the directory (vnd.android.cursor.dir/*)
in which to place the data.
Output: URI of the new data that was created.
public static final String ACTION_DELETE
Input: getData()
is URI of data to be deleted.
Output: nothing.
public static final String ACTION_RUN
Input: ? (Note: this is currently specific to the test harness.)
Output: nothing.
public static final String ACTION_SYNC
Input: ?
Output: ?
public static final String ACTION_PICK_ACTIVITY
Input: get*Extra field EXTRA_INTENT
is an Intent
used with PackageManager.queryIntentActivities(android.content.Intent, int)
to determine the
set of activities from which to pick.
Output: Class name of the activity that was selected.
public static final String ACTION_SEARCH
Input: getStringExtra(SearchManager.QUERY)
is the text to search for. If empty, simply
enter your search results Activity with the search UI activated.
Output: nothing.
public static final String ACTION_SYSTEM_TUTORIAL
Input: getStringExtra(SearchManager.QUERY)
is the text to search for. If empty, simply
enter your search results Activity with the search UI activated.
Output: nothing.
public static final String ACTION_WEB_SEARCH
Input: getStringExtra(SearchManager.QUERY)
is the text to search for. If it is
a url starts with http or https, the site will be opened. If it is plain
text, Google search will be applied.
Output: nothing.
public static final String ACTION_ASSIST
Input: EXTRA_ASSIST_PACKAGE
, EXTRA_ASSIST_CONTEXT
, can provide
additional optional contextual information about where the user was when they
requested the assist; EXTRA_REFERRER
may be set with additional referrer
information.
Output: nothing.
public static final String ACTION_VOICE_ASSIST
Input: EXTRA_ASSIST_PACKAGE
, EXTRA_ASSIST_CONTEXT
, can provide
additional optional contextual information about where the user was when they
requested the voice assist.
Output: nothing.
public static final String EXTRA_ASSIST_PACKAGE
ACTION_ASSIST
containing the name of the current foreground
application package at the time the assist was invoked.public static final String EXTRA_ASSIST_UID
ACTION_ASSIST
containing the uid of the current foreground
application package at the time the assist was invoked.public static final String EXTRA_ASSIST_CONTEXT
ACTION_ASSIST
and containing additional contextual
information supplied by the current foreground app at the time of the assist request.
This is a Bundle
of additional data.public static final String EXTRA_ASSIST_INPUT_HINT_KEYBOARD
ACTION_ASSIST
suggesting that the user will likely use a
keyboard as the primary input device for assistance.public static final String EXTRA_ASSIST_INPUT_DEVICE_ID
ACTION_ASSIST
containing the InputDevice id
that was used to invoke the assist.public static final String ACTION_ALL_APPS
Input: Nothing.
Output: nothing.
public static final String ACTION_SET_WALLPAPER
Input: Nothing.
Output: Nothing.
public static final String ACTION_BUG_REPORT
Input: Nothing.
Output: Nothing.
public static final String ACTION_FACTORY_TEST
Input: nothing
Output: nothing
public static final String ACTION_CALL_BUTTON
Input: Nothing.
Output: Nothing.
public static final String ACTION_VOICE_COMMAND
Input: Nothing.
Output: Nothing.
public static final String ACTION_SEARCH_LONG_PRESS
Input: Nothing.
Output: Nothing.
public static final String ACTION_APP_ERROR
Input: No data is specified. The bug report is passed in using
an EXTRA_BUG_REPORT
field.
Output: Nothing.
EXTRA_BUG_REPORT
,
Constant Field Valuespublic static final String ACTION_POWER_USAGE_SUMMARY
Input: Nothing.
Output: Nothing.
public static final String ACTION_UPGRADE_SETUP
METADATA_SETUP_VERSION
, which defines the current version of
the platform for setup. The activity will be launched only if
Settings.Secure.LAST_SETUP_SHOWN
is not the
same value.
Input: Nothing.
Output: Nothing.
public static final String ACTION_SHOW_KEYBOARD_SHORTCUTS
Input: Nothing.
Output: Nothing.
public static final String ACTION_DISMISS_KEYBOARD_SHORTCUTS
Input: Nothing.
Output: Nothing.
public static final String ACTION_MANAGE_NETWORK_USAGE
public static final String ACTION_INSTALL_PACKAGE
Input: The data must be a content: or file: URI at which the application
can be retrieved. As of
Output: If
Note:If your app is targeting API level higher than 22 you
need to hold Build.VERSION_CODES.JELLY_BEAN_MR1
,
you can also use "package:EXTRA_INSTALLER_PACKAGE_NAME
, EXTRA_NOT_UNKNOWN_SOURCE
,
EXTRA_ALLOW_REPLACE
, and EXTRA_RETURN_RESULT
.
EXTRA_RETURN_RESULT
, returns whether the install
succeeded.
android.Manifest.permission#REQUEST_INSTALL_PACKAGES
in order to launch the application installer.
public static final String ACTION_INSTALL_EPHEMERAL_PACKAGE
Input: The data must be a http: URI that the ephemeral application is registered to handle.
This is a protected intent that can only be sent by the system.
public static final String ACTION_RESOLVE_EPHEMERAL_PACKAGE
The system will have a persistent connection to this service. This is a protected intent that can only be sent by the system.
public static final String EXTRA_INSTALLER_PACKAGE_NAME
ACTION_INSTALL_PACKAGE
to install a
package. Specifies the installer package name; this package will receive the
ACTION_APP_ERROR
intent.public static final String EXTRA_NOT_UNKNOWN_SOURCE
ACTION_INSTALL_PACKAGE
to install a
package. Specifies that the application being installed should not be
treated as coming from an unknown source, but as coming from the app
invoking the Intent. For this to work you must start the installer with
startActivityForResult().public static final String EXTRA_ORIGINATING_URI
ACTION_INSTALL_PACKAGE
and
ACTION_VIEW
to indicate the URI from which the local APK in the Intent
data field originated from.public static final String EXTRA_REFERRER
Uri
object, typically an http: or https: URI of the web site that the referral came from;
it can also use the android-app:
scheme to identify
a native application that it came from.
To retrieve this value in a client, use Activity.getReferrer()
instead of directly retrieving the extra. It is also valid for applications to
instead supply EXTRA_REFERRER_NAME
for cases where they can only create
a string, not a Uri; the field here, if supplied, will always take precedence,
however.
EXTRA_REFERRER_NAME
,
Constant Field Valuespublic static final String EXTRA_REFERRER_NAME
EXTRA_REFERRER
that supplies the URI as a String rather
than a Uri
object. Only for use in cases where Uri objects can
not be created, in particular when Intent extras are supplied through the
intent:
or android-app:
schemes.EXTRA_REFERRER
,
Constant Field Valuespublic static final String EXTRA_ORIGINATING_UID
ACTION_INSTALL_PACKAGE
and
ACTION_VIEW
to indicate the uid of the package that initiated the install@Deprecated public static final String EXTRA_ALLOW_REPLACE
Build.VERSION_CODES.JELLY_BEAN
, Android
will no longer show an interstitial message about updating existing
applications so this is no longer needed.ACTION_INSTALL_PACKAGE
to install a
package. Tells the installer UI to skip the confirmation with the user
if the .apk is replacing an existing one.public static final String EXTRA_RETURN_RESULT
ACTION_INSTALL_PACKAGE
or
ACTION_UNINSTALL_PACKAGE
. Specifies that the installer UI should
return to the application the result code of the install/uninstall. The returned result
code will be Activity.RESULT_OK
on success or
Activity.RESULT_FIRST_USER
on failure.public static final String EXTRA_INSTALL_RESULT
public static final String ACTION_UNINSTALL_PACKAGE
Input: The data must be a package: URI whose scheme specific part is
the package name of the current installed package to be uninstalled.
You can optionally supply EXTRA_RETURN_RESULT
.
Output: If EXTRA_RETURN_RESULT
, returns whether the install
succeeded.
public static final String EXTRA_UNINSTALL_ALL_USERS
public static final String METADATA_SETUP_VERSION
ACTION_UPGRADE_SETUP
activity
describing the last run version of the platform that was setup.public static final String ACTION_MANAGE_APP_PERMISSIONS
Input: EXTRA_PACKAGE_NAME
specifies the package whose permissions
will be managed by the launched UI.
Output: Nothing.
EXTRA_PACKAGE_NAME
,
Constant Field Valuespublic static final String ACTION_MANAGE_PERMISSIONS
Input: Nothing.
Output: Nothing.
public static final String ACTION_REVIEW_PERMISSIONS
Input: EXTRA_PACKAGE_NAME
specifies the package whose
permissions will be reviewed (mandatory).
Input: EXTRA_INTENT
specifies a pending intent to
be fired after the permission review (optional).
Input: EXTRA_REMOTE_CALLBACK
specifies a callback to
be invoked after the permission review (optional).
Input: EXTRA_RESULT_NEEDED
specifies whether the intent
passed via EXTRA_INTENT
needs a result (optional).
Output: Nothing.
public static final String EXTRA_REMOTE_CALLBACK
Type: IRemoteCallback
public static final String EXTRA_PACKAGE_NAME
Type: String
public static final String EXTRA_RESULT_NEEDED
Type: boolean
public static final String ACTION_MANAGE_PERMISSION_APPS
Input: EXTRA_PERMISSION_NAME
specifies the permission access
to which will be managed by the launched UI.
Output: Nothing.
EXTRA_PERMISSION_NAME
,
Constant Field Valuespublic static final String EXTRA_PERMISSION_NAME
Type: String
public static final String ACTION_SCREEN_OFF
For historical reasons, the name of this broadcast action refers to the power state of the screen but it is actually sent in response to changes in the overall interactive state of the device.
This broadcast is sent when the device becomes non-interactive which may have
nothing to do with the screen turning off. To determine the
actual state of the screen, use Display.getState()
.
See PowerManager.isInteractive()
for details.
Context.registerReceiver()
.
This is a protected intent that can only be sent by the system.
public static final String ACTION_SCREEN_ON
For historical reasons, the name of this broadcast action refers to the power state of the screen but it is actually sent in response to changes in the overall interactive state of the device.
This broadcast is sent when the device becomes interactive which may have
nothing to do with the screen turning on. To determine the
actual state of the screen, use Display.getState()
.
See PowerManager.isInteractive()
for details.
Context.registerReceiver()
.
This is a protected intent that can only be sent by the system.
public static final String ACTION_DREAMING_STOPPED
This is a protected intent that can only be sent by the system. It is only sent to registered receivers.
public static final String ACTION_DREAMING_STARTED
This is a protected intent that can only be sent by the system. It is only sent to registered receivers.
public static final String ACTION_USER_PRESENT
This is a protected intent that can only be sent by the system.
public static final String ACTION_TIME_TICK
Context.registerReceiver()
.
This is a protected intent that can only be sent by the system.
public static final String ACTION_TIME_CHANGED
public static final String ACTION_DATE_CHANGED
public static final String ACTION_TIMEZONE_CHANGED
This is a protected intent that can only be sent by the system.
public static final String ACTION_CLEAR_DNS_CACHE
public static final String ACTION_ALARM_CHANGED
public static final String ACTION_LOCKED_BOOT_COMPLETED
android.Manifest.permission#RECEIVE_BOOT_COMPLETED
permission in order to receive this broadcast.
This broadcast is sent immediately at boot by all devices (regardless of
direct boot support) running Build.VERSION_CODES.N
or
higher. Upon receipt of this broadcast, the user is still locked and only
device-protected storage can be accessed safely. If you want to access
credential-protected storage, you need to wait for the user to be
unlocked (typically by entering their lock pattern or PIN for the first
time), after which the ACTION_USER_UNLOCKED
and
ACTION_BOOT_COMPLETED
broadcasts are sent.
To receive this broadcast, your receiver component must be marked as
being ComponentInfo.directBootAware
.
This is a protected intent that can only be sent by the system.
public static final String ACTION_BOOT_COMPLETED
android.Manifest.permission#RECEIVE_BOOT_COMPLETED
permission in
order to receive this broadcast.
This broadcast is sent at boot by all devices (both with and without direct boot support). Upon receipt of this broadcast, the user is unlocked and both device-protected and credential-protected storage can accessed safely.
If you need to run while the user is still locked (before they've entered
their lock pattern or PIN for the first time), you can listen for the
ACTION_LOCKED_BOOT_COMPLETED
broadcast.
This is a protected intent that can only be sent by the system.
public static final String ACTION_CLOSE_SYSTEM_DIALOGS
@Deprecated public static final String ACTION_PACKAGE_INSTALL
Input: getData()
is the URI of the package file to download.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_ADDED
May include the following extras:
EXTRA_UID
containing the integer uid assigned to the new package.
EXTRA_REPLACING
is set to true if this is following
an ACTION_PACKAGE_REMOVED
broadcast for the same package.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_REPLACED
May include the following extras:
EXTRA_UID
containing the integer uid assigned to the new package.
This is a protected intent that can only be sent by the system.
public static final String ACTION_MY_PACKAGE_REPLACED
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_REMOVED
EXTRA_UID
containing the integer uid previously assigned
to the package.
EXTRA_DATA_REMOVED
is set to true if the entire
application -- data and code -- is being removed.
EXTRA_REPLACING
is set to true if this will be followed
by an ACTION_PACKAGE_ADDED
broadcast for the same package.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_FULLY_REMOVED
ACTION_PACKAGE_REMOVED
, but only set when
EXTRA_DATA_REMOVED
is true and
EXTRA_REPLACING
is false of that broadcast.
EXTRA_UID
containing the integer uid previously assigned
to the package.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_CHANGED
EXTRA_UID
containing the integer uid assigned to the package.
EXTRA_CHANGED_COMPONENT_NAME_LIST
containing the class name
of the changed components (or the package name itself).
EXTRA_DONT_KILL_APP
containing boolean field to override the
default action of restarting the application.
This is a protected intent that can only be sent by the system.
public static final String ACTION_QUERY_PACKAGE_RESTART
public static final String ACTION_PACKAGE_RESTARTED
EXTRA_UID
containing the integer uid assigned to the package.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_DATA_CLEARED
ACTION_PACKAGE_RESTARTED
, after which all of
its persistent data is erased and this broadcast sent.
Note that the cleared package does not
receive this broadcast. The data contains the name of the package.
EXTRA_UID
containing the integer uid assigned to the package.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGES_SUSPENDED
Includes the following extras:
EXTRA_CHANGED_PACKAGE_LIST
is the set of packages which have been suspended
This is a protected intent that can only be sent by the system. It is only sent to registered receivers.
public static final String ACTION_PACKAGES_UNSUSPENDED
Includes the following extras:
EXTRA_CHANGED_PACKAGE_LIST
is the set of packages which have been unsuspended
This is a protected intent that can only be sent by the system. It is only sent to registered receivers.
public static final String ACTION_UID_REMOVED
EXTRA_UID
.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_FIRST_LAUNCH
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_NEEDS_VERIFICATION
This is a protected intent that can only be sent by the system.
public static final String ACTION_PACKAGE_VERIFIED
This is a protected intent that can only be sent by the system.
public static final String ACTION_INTENT_FILTER_NEEDS_VERIFICATION
This is a protected intent that can only be sent by the system.
public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
EXTRA_CHANGED_PACKAGE_LIST
contains a
list of packages whose availability changed.
The extra data EXTRA_CHANGED_UID_LIST
contains a
list of uids of packages whose availability changed.
Note that the
packages in this list do not receive this broadcast.
The specified set of packages are now available on the system.
Includes the following extras:
EXTRA_CHANGED_PACKAGE_LIST
is the set of packages
whose resources(were previously unavailable) are currently available.
EXTRA_CHANGED_UID_LIST
is the set of uids of the
packages whose resources(were previously unavailable)
are currently available.
This is a protected intent that can only be sent by the system.
public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE
EXTRA_CHANGED_PACKAGE_LIST
contains a
list of packages whose availability changed.
The extra data EXTRA_CHANGED_UID_LIST
contains a
list of uids of packages whose availability changed.
The specified set of packages can no longer be
launched and are practically unavailable on the system.
Inclues the following extras:
EXTRA_CHANGED_PACKAGE_LIST
is the set of packages
whose resources are no longer available.
EXTRA_CHANGED_UID_LIST
is the set of packages
whose resources are no longer available.
This is a protected intent that can only be sent by the system.
public static final String ACTION_PREFERRED_ACTIVITY_CHANGED
Note there are cases where a preferred activity is invalidated *implicitly*, e.g.
when an app is installed or uninstalled, but in such cases this broadcast will *not*
be sent.
EXTRA_USER_HANDLE
contains the user ID in question.
@Deprecated public static final String ACTION_WALLPAPER_CHANGED
WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
to have the wallpaper
shown behind their UI, rather than watching for this broadcast and
rendering the wallpaper on their own.WallpaperManager
for retrieving the new wallpaper.
This should only be used to determine when the wallpaper
has changed to show the new wallpaper to the user. You should certainly
never, in response to this, change the wallpaper or other attributes of
it such as the suggested size. That would be crazy, right? You'd cause
all kinds of loops, especially if other apps are doing similar things,
right? Of course. So please don't do this.public static final String ACTION_CONFIGURATION_CHANGED
Configuration
(orientation, locale, etc) has changed. When such a change happens, the
UIs (view hierarchy) will need to be rebuilt based on this new
information; for the most part, applications don't need to worry about
this, because the system will take care of stopping and restarting the
application to make sure it sees the new changes. Some system code that
can not be restarted will need to watch for this action and handle it
appropriately.
You cannot receive this through components declared
in manifests, only by explicitly registering for it with
Context.registerReceiver()
.
This is a protected intent that can only be sent by the system.
Configuration
,
Constant Field Valuespublic static final String ACTION_LOCALE_CHANGED
This is a protected intent that can only be sent by the system.
public static final String ACTION_BATTERY_CHANGED
BatteryManager
for documentation on the
contents of the Intent.
You cannot receive this through components declared
in manifests, only by explicitly registering for it with
Context.registerReceiver()
. See ACTION_BATTERY_LOW
,
ACTION_BATTERY_OKAY
, ACTION_POWER_CONNECTED
,
and ACTION_POWER_DISCONNECTED
for distinct battery-related
broadcasts that are sent and can be received through manifest
receivers.
This is a protected intent that can only be sent by the system.
public static final String ACTION_BATTERY_LOW
This is a protected intent that can only be sent by the system.
public static final String ACTION_BATTERY_OKAY
ACTION_BATTERY_LOW
once the battery has
gone back up to an okay state.
This is a protected intent that can only be sent by the system.
public static final String ACTION_POWER_CONNECTED
This is a protected intent that can only be sent by the system.
public static final String ACTION_POWER_DISCONNECTED
This is a protected intent that can only be sent by the system.
public static final String ACTION_SHUTDOWN
This is a protected intent that can only be sent by the system.
May include the following extras:
EXTRA_SHUTDOWN_USERSPACE_ONLY
a boolean that is set to true if this
shutdown is only for userspace processes. If not set, assumed to be false.
public static final String ACTION_REQUEST_SHUTDOWN
EXTRA_KEY_CONFIRM
can be set to true
to request confirmation from the user before shutting down. The optional boolean
extra field EXTRA_USER_REQUESTED_SHUTDOWN
can be set to true to
indicate that the shutdown is requested by the user.
This is a protected intent that can only be sent by the system.
public static final String ACTION_DEVICE_STORAGE_LOW
This is a protected intent that can only be sent by the system.
public static final String ACTION_DEVICE_STORAGE_OK
This is a protected intent that can only be sent by the system.
public static final String ACTION_DEVICE_STORAGE_FULL
This is a protected intent that can only be sent by the system.
public static final String ACTION_DEVICE_STORAGE_NOT_FULL
This is a protected intent that can only be sent by the system.
public static final String ACTION_MANAGE_PACKAGE_STORAGE
@Deprecated public static final String ACTION_UMS_CONNECTED
@Deprecated public static final String ACTION_UMS_DISCONNECTED
public static final String ACTION_MEDIA_REMOVED
public static final String ACTION_MEDIA_UNMOUNTED
public static final String ACTION_MEDIA_CHECKING
public static final String ACTION_MEDIA_NOFS
public static final String ACTION_MEDIA_MOUNTED
public static final String ACTION_MEDIA_SHARED
public static final String ACTION_MEDIA_UNSHARED
public static final String ACTION_MEDIA_BAD_REMOVAL
public static final String ACTION_MEDIA_UNMOUNTABLE
public static final String ACTION_MEDIA_EJECT
public static final String ACTION_MEDIA_SCANNER_STARTED
public static final String ACTION_MEDIA_SCANNER_FINISHED
public static final String ACTION_MEDIA_SCANNER_SCAN_FILE
public static final String ACTION_MEDIA_BUTTON
EXTRA_KEY_EVENT
, containing the key event that
caused the broadcast.public static final String ACTION_CAMERA_BUTTON
EXTRA_KEY_EVENT
, containing the key event that
caused the broadcast.public static final String ACTION_GTALK_SERVICE_CONNECTED
public static final String ACTION_GTALK_SERVICE_DISCONNECTED
public static final String ACTION_INPUT_METHOD_CHANGED
public static final String ACTION_AIRPLANE_MODE_CHANGED
Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or more radios have been turned off or on. The intent will have the following extra value:
This is a protected intent that can only be sent by the system.
public static final String ACTION_PROVIDER_CHANGED
The data of the intent identifies which part of which provider changed. When queried through the content resolver, the data URI will return the data set in question.
The intent will have the following extra values:
public static final String ACTION_HEADSET_PLUG
AudioManager.ACTION_HEADSET_PLUG
, to be consulted for value
and documentation.
If the minimum SDK version of your application is
Build.VERSION_CODES.LOLLIPOP
, it is recommended to refer
to the AudioManager
constant in your receiver registration code instead.
public static final String ACTION_ADVANCED_SETTINGS_CHANGED
Broadcast Action: The user has switched on advanced settings in the settings app:
This is a protected intent that can only be sent by the system.
public static final String ACTION_APPLICATION_RESTRICTIONS_CHANGED
This is a protected intent that can only be sent by the system.
public static final String ACTION_NEW_OUTGOING_CALL
The Intent will have the following extra value:
EXTRA_PHONE_NUMBER
-
the phone number originally intended to be dialed.Once the broadcast is finished, the resultData is used as the actual
number to call. If null
, no call will be placed.
It is perfectly acceptable for multiple receivers to process the outgoing call in turn: for example, a parental control application might verify that the user is authorized to place the call at that time, then a number-rewriting application might add an area code if one was not specified.
For consistency, any receiver whose purpose is to prohibit phone calls should have a priority of 0, to ensure it will see the final phone number to be dialed. Any receiver whose purpose is to rewrite phone numbers to be called should have a positive priority. Negative priorities are reserved for the system for this broadcast; using them may cause problems.
Any BroadcastReceiver receiving this Intent must not abort the broadcast.
Emergency calls cannot be intercepted using this mechanism, and other calls cannot be modified to call emergency numbers using this mechanism.
Some apps (such as VoIP apps) may want to redirect the outgoing
call to use their own service instead. Those apps should first prevent
the call from being placed by setting resultData to null
and then start their own app to make the call.
You must hold the
android.Manifest.permission#PROCESS_OUTGOING_CALLS
permission to receive this Intent.
This is a protected intent that can only be sent by the system.
public static final String ACTION_REBOOT
This is a protected intent that can only be sent by the system.
public static final String ACTION_DOCK_EVENT
The intent will have the following extra values:
EXTRA_DOCK_STATE
- the current dock
state, indicating which dock the device is physically in.This is intended for monitoring the current physical dock state.
See UiModeManager
for the normal API dealing with
dock mode changes.
public static final String ACTION_IDLE_MAINTENANCE_START
In order to keep the device responsive in case of an
unexpected user interaction, implementations of a maintenance task
should be interruptible. In such a scenario a broadcast with action
ACTION_IDLE_MAINTENANCE_END
will be sent. In other words, you
should not do the maintenance work in
BroadcastReceiver.onReceive(Context, Intent)
, rather start a
maintenance service by Context.startService(Intent)
. Also
you should hold a wake lock while your maintenance service is running
to prevent the device going to sleep.
This is a protected intent that can only be sent by the system.
ACTION_IDLE_MAINTENANCE_END
,
Constant Field Valuespublic static final String ACTION_IDLE_MAINTENANCE_END
ACTION_IDLE_MAINTENANCE_START
was sent and now the user started interacting with the device. Typical
use of the idle maintenance is to perform somehow expensive tasks that
can be postponed at a moment when they will not degrade user experience.
In order to keep the device responsive in case of an
unexpected user interaction, implementations of a maintenance task
should be interruptible. Hence, on receiving a broadcast with this
action, the maintenance task should be interrupted as soon as possible.
In other words, you should not do the maintenance work in
BroadcastReceiver.onReceive(Context, Intent)
, rather stop the
maintenance service that was started on receiving of
ACTION_IDLE_MAINTENANCE_START
.Also you should release the wake
lock you acquired when your maintenance service started.
This is a protected intent that can only be sent by the system.
public static final String ACTION_REMOTE_INTENT
public static final String ACTION_PRE_BOOT_COMPLETED
This broadcast is sent after the ACTION_LOCKED_BOOT_COMPLETED
broadcast but before the ACTION_BOOT_COMPLETED
broadcast. It's
only sent when the Build.FINGERPRINT
has changed, and it's only
sent to receivers in the system image.
public static final String ACTION_GET_RESTRICTION_ENTRIES
EXTRA_RESTRICTIONS_BUNDLE
with the currently persisted
restrictions as a Bundle of key/value pairs. The value types can be Boolean, String or
String[] depending on the restriction type.
The response should contain an extra EXTRA_RESTRICTIONS_LIST
,
which is of type ArrayList<RestrictionEntry>
. It can also
contain an extra EXTRA_RESTRICTIONS_INTENT
, which is of type Intent
.
The activity specified by that intent will be launched for a result which must contain
one of the extras EXTRA_RESTRICTIONS_LIST
or EXTRA_RESTRICTIONS_BUNDLE
.
The keys and values of the returned restrictions will be persisted.RestrictionEntry
,
Constant Field Valuespublic static final String ACTION_USER_INITIALIZE
ACTION_BOOT_COMPLETED
is sent. This is sent as a foreground
broadcast, since it is part of a visible user interaction; be as quick
as possible when handling it.public static final String ACTION_USER_FOREGROUND
Context.registerReceiver
. It is sent to the user that is going to the
foreground. This is sent as a foreground
broadcast, since it is part of a visible user interaction; be as quick
as possible when handling it.public static final String ACTION_USER_BACKGROUND
Context.registerReceiver
. It is sent to the user that is going to the
background. This is sent as a foreground
broadcast, since it is part of a visible user interaction; be as quick
as possible when handling it.public static final String ACTION_USER_ADDED
android.Manifest.permission#MANAGE_USERS
to receive this broadcast.public static final String ACTION_USER_STARTED
public static final String ACTION_USER_STARTING
android.Manifest.permission#INTERACT_ACROSS_USERS
to receive
this broadcast. This is sent as a background broadcast, since
its result is not part of the primary UX flow; to safely keep track of
started/stopped state of a user you can use this in conjunction with
ACTION_USER_STOPPING
. It is not generally safe to use with
other user state broadcasts since those are foreground broadcasts so can
execute in a different order.public static final String ACTION_USER_STOPPING
android.Manifest.permission#INTERACT_ACROSS_USERS
to receive
this broadcast. The user will not stop until all receivers have
handled the broadcast. This is sent as a background broadcast, since
its result is not part of the primary UX flow; to safely keep track of
started/stopped state of a user you can use this in conjunction with
ACTION_USER_STARTING
. It is not generally safe to use with
other user state broadcasts since those are foreground broadcasts so can
execute in a different order.public static final String ACTION_USER_STOPPED
ACTION_PACKAGE_RESTARTED
, but for an entire user instead of a
specific package. This is only sent to registered receivers, not manifest
receivers. It is sent to all running users except the one that
has just been stopped (which is no longer running).public static final String ACTION_USER_REMOVED
android.Manifest.permission#MANAGE_USERS
to receive this broadcast.public static final String ACTION_USER_SWITCHED
android.Manifest.permission#MANAGE_USERS
to receive this broadcast.public static final String ACTION_USER_UNLOCKED
public static final String ACTION_USER_INFO_CHANGED
EXTRA_USER_HANDLE
to indicate which user's information changed.
This is only sent to registered receivers, not manifest receivers. It is sent to all users.public static final String ACTION_MANAGED_PROFILE_ADDED
EXTRA_USER
that specifies
the UserHandle of the profile that was added. Only applications (for example Launchers)
that need to display merged content across both primary and managed profiles need to
worry about this broadcast. This is only sent to registered receivers,
not manifest receivers.public static final String ACTION_MANAGED_PROFILE_REMOVED
EXTRA_USER
that specifies the UserHandle of the profile that was removed.
Only applications (for example Launchers) that need to display merged content across both
primary and managed profiles need to worry about this broadcast. This is only sent to
registered receivers, not manifest receivers.public static final String ACTION_MANAGED_PROFILE_UNLOCKED
EXTRA_USER
that
specifies the UserHandle of the profile that was unlocked. Only applications (for example
Launchers) that need to display merged content across both primary and managed profiles
need to worry about this broadcast. This is only sent to registered receivers,
not manifest receivers.public static final String ACTION_MANAGED_PROFILE_AVAILABLE
EXTRA_USER
that specifies the UserHandle of the profile. When quiet mode is changed,
this broadcast will carry a boolean extra EXTRA_QUIET_MODE
indicating the new state
of quiet mode. This is only sent to registered receivers, not manifest receivers.public static final String ACTION_MANAGED_PROFILE_UNAVAILABLE
EXTRA_USER
that specifies the UserHandle of the profile. When quiet mode is changed,
this broadcast will carry a boolean extra EXTRA_QUIET_MODE
indicating the new state
of quiet mode. This is only sent to registered receivers, not manifest receivers.public static final String ACTION_QUICK_CLOCK
public static final String ACTION_SHOW_BRIGHTNESS_DIALOG
public static final String ACTION_GLOBAL_BUTTON
EXTRA_KEY_EVENT
, containing the key event that
caused the broadcast.public static final String ACTION_MEDIA_RESOURCE_GRANTED
EXTRA_PACKAGES
specifies the packages on the process holding the media resource
granted.
This is a protected intent that can only be sent by the system.
This requires android.Manifest.permission#RECEIVE_MEDIA_RESOURCE_USAGE
permission.
public static final String ACTION_OPEN_DOCUMENT
DocumentsProvider
instances installed on the device, letting the
user interactively navigate through them. These documents include local
media, such as photos and video, and documents provided by installed
cloud storage providers.
Each document is represented as a content://
URI backed by a
DocumentsProvider
, which can be opened as a stream with
ContentResolver.openFileDescriptor(Uri, String)
, or queried for
DocumentsContract.Document
metadata.
All selected documents are returned to the calling application with
persistable read and write permission grants. If you want to maintain
access to the documents across device reboots, you need to explicitly
take the persistable permissions using
ContentResolver.takePersistableUriPermission(Uri, int)
.
Callers must indicate the acceptable document MIME types through
setType(String)
. For example, to select photos, use
image/*
. If multiple disjoint MIME types are acceptable, define
them in EXTRA_MIME_TYPES
and setType(String)
to
*/*.
If the caller can handle multiple returned items (the user performing
multiple selection), then you can specify EXTRA_ALLOW_MULTIPLE
to indicate this.
Callers must include CATEGORY_OPENABLE
in the Intent to obtain
URIs that can be opened with
ContentResolver.openFileDescriptor(Uri, String)
.
Output: The URI of the item that was picked, returned in
getData()
. This must be a content://
URI so that any
receiver can access it. If multiple documents were selected, they are
returned in getClipData()
.
public static final String ACTION_CREATE_DOCUMENT
DocumentsProvider
instances
installed on the device, letting the user navigate through them. The
returned document may be a newly created document with no content, or it
may be an existing document with the requested MIME type.
Each document is represented as a content://
URI backed by a
DocumentsProvider
, which can be opened as a stream with
ContentResolver.openFileDescriptor(Uri, String)
, or queried for
DocumentsContract.Document
metadata.
Callers must indicate the concrete MIME type of the document being
created by setting setType(String)
. This MIME type cannot be
changed after the document is created.
Callers can provide an initial display name through EXTRA_TITLE
,
but the user may change this value before creating the file.
Callers must include CATEGORY_OPENABLE
in the Intent to obtain
URIs that can be opened with
ContentResolver.openFileDescriptor(Uri, String)
.
Output: The URI of the item that was created. This must be a
content://
URI so that any receiver can access it.
public static final String ACTION_OPEN_DOCUMENT_TREE
DocumentsProvider
instances installed on the device, letting the user navigate through
them. Apps can fully manage documents within the returned directory.
To gain access to descendant (child, grandchild, etc) documents, use
DocumentsContract.buildDocumentUriUsingTree(Uri, String)
and
DocumentsContract.buildChildDocumentsUriUsingTree(Uri, String)
with the returned URI.
Output: The URI representing the selected directory tree.
DocumentsContract
,
Constant Field Valuespublic static final String ACTION_DYNAMIC_SENSOR_CHANGED
This is a protected intent that can only be sent by the system.
public static final String ACTION_MASTER_CLEAR
public static final String EXTRA_FORCE_MASTER_CLEAR
ACTION_MASTER_CLEAR
in order to force a factory
reset even if android.os.UserManager.DISALLOW_FACTORY_RESET
is set.public static final String ACTION_SETTING_RESTORED
This broadcast is sent only for settings provider entries known to require special handling around restore time. These entries are found in the BROADCAST_ON_RESTORE table within the provider's backup agent implementation.
public static final String EXTRA_SETTING_NAME
public static final String EXTRA_SETTING_PREVIOUS_VALUE
public static final String EXTRA_SETTING_NEW_VALUE
public static final String ACTION_PROCESS_TEXT
Input: EXTRA_PROCESS_TEXT
contains the text to be processed.
EXTRA_PROCESS_TEXT_READONLY
states if the resulting text will be read-only.
Output: EXTRA_PROCESS_TEXT
contains the processed text.
public static final String EXTRA_PROCESS_TEXT
Bundle.getCharSequence()
to retrieve it.public static final String EXTRA_PROCESS_TEXT_READONLY
public static final String ACTION_THERMAL_EVENT
public static final String EXTRA_THERMAL_STATE
public static final int EXTRA_THERMAL_STATE_NORMAL
ACTION_THERMAL_EVENT
broadcast as EXTRA_THERMAL_STATE
.
public static final int EXTRA_THERMAL_STATE_WARNING
ACTION_THERMAL_EVENT
broadcast as EXTRA_THERMAL_STATE
.
public static final int EXTRA_THERMAL_STATE_EXCEEDED
ACTION_THERMAL_EVENT
broadcast as EXTRA_THERMAL_STATE
.
public static final String CATEGORY_DEFAULT
public static final String CATEGORY_BROWSABLE
public static final String CATEGORY_VOICE
VoiceInteractor
to interact with the user.public static final String CATEGORY_ALTERNATIVE
CATEGORY_SELECTED_ALTERNATIVE
for an alternative action that
applies to the selection in a list of items.
Supporting this category means that you would like your activity to be displayed in the set of alternative things the user can do, usually as part of the current activity's options menu. You will usually want to include a specific label in the <intent-filter> of this action describing to the user what it does.
The action of IntentFilter with this category is important in that it
describes the specific action the target will perform. This generally
should not be a generic action (such as ACTION_VIEW
, but rather
a specific name such as "com.android.camera.action.CROP. Only one
alternative of any particular action will be shown to the user, so using
a specific action like this makes sure that your alternative will be
displayed while also allowing other applications to provide their own
overrides of that particular action.
public static final String CATEGORY_SELECTED_ALTERNATIVE
CATEGORY_ALTERNATIVE
, but is used in activities showing a list
of items from which the user can select, giving them alternatives to the
default action that will be performed on it.public static final String CATEGORY_TAB
public static final String CATEGORY_LAUNCHER
public static final String CATEGORY_LEANBACK_LAUNCHER
public static final String CATEGORY_LEANBACK_SETTINGS
public static final String CATEGORY_INFO
CATEGORY_LAUNCHER
to provide
a front-door to the user without having to be shown in the all apps list.public static final String CATEGORY_HOME
public static final String CATEGORY_HOME_MAIN
public static final String CATEGORY_SETUP_WIZARD
public static final String CATEGORY_PREFERENCE
public static final String CATEGORY_DEVELOPMENT_PREFERENCE
public static final String CATEGORY_EMBED
public static final String CATEGORY_APP_MARKET
public static final String CATEGORY_MONKEY
public static final String CATEGORY_TEST
public static final String CATEGORY_UNIT_TEST
public static final String CATEGORY_SAMPLE_CODE
public static final String CATEGORY_OPENABLE
ContentResolver.openFileDescriptor(Uri, String)
. Openable URIs
must support at least the columns defined in OpenableColumns
when
queried.public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST
public static final String CATEGORY_CAR_DOCK
ACTION_MAIN
to launch an activity. For more
information, see UiModeManager
.public static final String CATEGORY_DESK_DOCK
ACTION_MAIN
to launch an activity. For more
information, see UiModeManager
.public static final String CATEGORY_LE_DESK_DOCK
ACTION_MAIN
to launch an activity. For more
information, see UiModeManager
.public static final String CATEGORY_HE_DESK_DOCK
ACTION_MAIN
to launch an activity. For more
information, see UiModeManager
.public static final String CATEGORY_CAR_MODE
public static final String CATEGORY_APP_BROWSER
ACTION_MAIN
to launch the browser application.
The activity should be able to browse the Internet.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_CALCULATOR
ACTION_MAIN
to launch the calculator application.
The activity should be able to perform standard arithmetic operations.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_CALENDAR
ACTION_MAIN
to launch the calendar application.
The activity should be able to view and manipulate calendar entries.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_CONTACTS
ACTION_MAIN
to launch the contacts application.
The activity should be able to view and manipulate address book entries.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_EMAIL
ACTION_MAIN
to launch the email application.
The activity should be able to send and receive email.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_GALLERY
ACTION_MAIN
to launch the gallery application.
The activity should be able to view and manipulate image and video files
stored on the device.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_MAPS
ACTION_MAIN
to launch the maps application.
The activity should be able to show the user's current location and surroundings.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_MESSAGING
ACTION_MAIN
to launch the messaging application.
The activity should be able to send and receive text messages.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String CATEGORY_APP_MUSIC
ACTION_MAIN
to launch the music application.
The activity should be able to play, browse, or manipulate music files
stored on the device.
NOTE: This should not be used as the primary key of an Intent,
since it will not result in the app launching with the correct
action and category. Instead, use this with
makeMainSelectorActivity(String, String)
to generate a main
Intent with this category in the selector.
public static final String EXTRA_TEMPLATE
ACTION_INSERT
. The data here is a Map containing the same
fields as would be given to the underlying ContentProvider.insert()
call.public static final String EXTRA_TEXT
ACTION_SEND
to supply the literal data to be sent. Note that
this may be a styled CharSequence, so you must use
Bundle.getCharSequence()
to
retrieve it.public static final String EXTRA_HTML_TEXT
ACTION_SEND
to supply an alternative to EXTRA_TEXT
as HTML formatted text. Note that you must also supply
EXTRA_TEXT
.public static final String EXTRA_STREAM
ACTION_SEND
to supply the data being sent.public static final String EXTRA_EMAIL
public static final String EXTRA_CC
public static final String EXTRA_BCC
public static final String EXTRA_SUBJECT
public static final String EXTRA_INTENT
ACTION_PICK_ACTIVITY
or ACTION_CHOOSER
.public static final String EXTRA_USER_ID
public static final String EXTRA_TASK_ID
public static final String EXTRA_ALTERNATE_INTENTS
ACTION_CHOOSER
.
An app may be capable of providing several different payload types to complete a
user's intended action. For example, an app invoking ACTION_SEND
to share photos
with another app may use EXTRA_ALTERNATE_INTENTS to have the chooser transparently offer
several different supported sending mechanisms for sharing, such as the actual "image/*"
photo data or a hosted link where the photos can be viewed.
The intent present in EXTRA_INTENT
will be treated as the
first/primary/preferred intent in the set. Additional intents specified in
this extra are ordered; by default intents that appear earlier in the array will be
preferred over intents that appear later in the array as matches for the same
target component. To alter this preference, a calling app may also supply
EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER
.
public static final String EXTRA_EXCLUDE_COMPONENTS
ComponentName[]
describing components that should be filtered out
and omitted from a list of components presented to the user.
When used with ACTION_CHOOSER
, the chooser will omit any of the components
in this array if it otherwise would have shown them. Useful for omitting specific targets
from your own package or other apps from your organization if the idea of sending to those
targets would be redundant with other app functionality. Filtered components will not
be able to present targets from an associated ChooserTargetService
.
public static final String EXTRA_CHOOSER_TARGETS
ChooserTarget[]
for ACTION_CHOOSER
describing additional high-priority deep-link targets for the chooser to present to the user.
Targets provided in this way will be presented inline with all other targets provided by services from other apps. They will be prioritized before other service targets, but after those targets provided by sources that the user has manually pinned to the front.
ACTION_CHOOSER
,
Constant Field Valuespublic static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER
IntentSender
for an Activity that will be invoked when the user makes a selection
from the chooser activity presented by ACTION_CHOOSER
.
An app preparing an action for another app to complete may wish to allow the user to disambiguate between several options for completing the action based on the chosen target or otherwise refine the action before it is invoked.
When sent, this IntentSender may be filled in with the following extras:
EXTRA_INTENT
The first intent that matched the user's chosen targetEXTRA_ALTERNATE_INTENTS
Any additional intents that also matched the user's
chosen target beyond the firstEXTRA_RESULT_RECEIVER
A ResultReceiver
that the refinement activity
should fill in and send once the disambiguation is completepublic static final String EXTRA_RESULT_RECEIVER
ResultReceiver
used to return data back to the sender.
Used to complete an app-specific
refinement
for ACTION_CHOOSER
.
If EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER
is present in the intent
used to start a ACTION_CHOOSER
activity this extra will be
filled in
to that IntentSender
and sent
when the user selects a target component from the chooser. It is up to the recipient
to send a result to this ResultReceiver to signal that disambiguation is complete
and that the chooser should invoke the user's choice.
The disambiguator should provide a Bundle to the ResultReceiver with an intent
assigned to the key EXTRA_INTENT
. This supplied intent will be used by the chooser
to match and fill in the final Intent or ChooserTarget before starting it.
The supplied intent must match
one of the intents from
EXTRA_INTENT
or EXTRA_ALTERNATE_INTENTS
passed to
EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER
to be accepted.
The result code passed to the ResultReceiver should be
Activity.RESULT_OK
if the refinement succeeded and the supplied intent's
target in the chooser should be started, or Activity.RESULT_CANCELED
if
the chooser should finish without starting a target.
public static final String EXTRA_TITLE
ACTION_CHOOSER
.public static final String EXTRA_INITIAL_INTENTS
Intent
or
LabeledIntent
objects as set with
putExtra(String, Parcelable[])
of additional activities to place
a the front of the list of choices, when shown to the user with a
ACTION_CHOOSER
.public static final String EXTRA_EPHEMERAL_SUCCESS
IntentSender
to start after ephemeral installation success.public static final String EXTRA_EPHEMERAL_FAILURE
IntentSender
to start after ephemeral installation failure.public static final String EXTRA_REPLACEMENT_EXTRAS
EXTRA_INTENT
when used with
ACTION_CHOOSER
. Each key should be a package name. The package need not
be currently installed on the device.
An application may choose to provide alternate extras for the case where a user
selects an activity from a predetermined set of target packages. If the activity
the user selects from the chooser belongs to a package with its package name as
a key in this bundle, the corresponding extras for that package will be merged with
the extras already present in the intent at EXTRA_INTENT
. If a replacement
extra has the same key as an extra already present in the intent it will overwrite
the extra from the intent.
Examples:
EXTRA_TEXT
to an application
when sharing with it via ACTION_SEND
, augmenting a link with additional query
parameters for that target.public static final String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER
IntentSender
that will be notified if a user successfully chooses a target
component to handle an action in an ACTION_CHOOSER
activity. The IntentSender
will have the extra EXTRA_CHOSEN_COMPONENT
appended to it containing the
ComponentName
of the chosen component.
In some situations this callback may never come, for example if the user abandons the chooser, switches to another task or any number of other reasons. Apps should not be written assuming that this callback will always occur.
public static final String EXTRA_CHOSEN_COMPONENT
ComponentName
chosen by the user to complete an action.public static final String EXTRA_KEY_EVENT
KeyEvent
object containing the event that
triggered the creation of the Intent it is in.public static final String EXTRA_KEY_CONFIRM
ACTION_REQUEST_SHUTDOWN
to request confirmation from the user
before shutting down.
public static final String EXTRA_USER_REQUESTED_SHUTDOWN
ACTION_REQUEST_SHUTDOWN
to indicate that the shutdown is
requested by the user.
public static final String EXTRA_DONT_KILL_APP
ACTION_PACKAGE_REMOVED
or
ACTION_PACKAGE_CHANGED
intents to override the default action
of restarting the application.public static final String EXTRA_PHONE_NUMBER
ACTION_NEW_OUTGOING_CALL
, or the actual
number to call in a ACTION_CALL
.public static final String EXTRA_UID
ACTION_UID_REMOVED
intents to supply the uid the package had been assigned. Also an optional
extra in ACTION_PACKAGE_REMOVED
or
ACTION_PACKAGE_CHANGED
for the same
purpose.public static final String EXTRA_PACKAGES
public static final String EXTRA_DATA_REMOVED
ACTION_PACKAGE_REMOVED
intents to indicate whether this represents a full uninstall (removing
both the code and its data) or a partial uninstall (leaving its data,
implying that this is an update).public static final String EXTRA_REMOVED_FOR_ALL_USERS
public static final String EXTRA_REPLACING
ACTION_PACKAGE_REMOVED
intents to indicate that this is a replacement of the package, so this
broadcast will immediately be followed by an add broadcast for a
different version of the same package.public static final String EXTRA_ALARM_COUNT
AlarmManager
intents
to tell the application being invoked how many pending alarms are being
delievered with the intent. For one-shot alarms this will always be 1.
For recurring alarms, this might be greater than 1 if the device was
asleep or powered off at the time an earlier alarm would have been
delivered.public static final String EXTRA_DOCK_STATE
ACTION_DOCK_EVENT
intents to request the dock state. Possible values are
EXTRA_DOCK_STATE_UNDOCKED
,
EXTRA_DOCK_STATE_DESK
, or
EXTRA_DOCK_STATE_CAR
, or
EXTRA_DOCK_STATE_LE_DESK
, or
EXTRA_DOCK_STATE_HE_DESK
.public static final int EXTRA_DOCK_STATE_UNDOCKED
EXTRA_DOCK_STATE
to represent that the phone is not in any dock.public static final int EXTRA_DOCK_STATE_DESK
EXTRA_DOCK_STATE
to represent that the phone is in a desk dock.public static final int EXTRA_DOCK_STATE_CAR
EXTRA_DOCK_STATE
to represent that the phone is in a car dock.public static final int EXTRA_DOCK_STATE_LE_DESK
EXTRA_DOCK_STATE
to represent that the phone is in a analog (low end) dock.public static final int EXTRA_DOCK_STATE_HE_DESK
EXTRA_DOCK_STATE
to represent that the phone is in a digital (high end) dock.public static final String METADATA_DOCK_HOME
public static final String EXTRA_BUG_REPORT
ACTION_APP_ERROR
, containing
the bug report.public static final String EXTRA_REMOTE_INTENT_TOKEN
@Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME
EXTRA_CHANGED_COMPONENT_NAME_LIST
; this field
will contain only the first name in the list.public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST
ACTION_PACKAGE_CHANGED
,
and contains a string array of all of the components that have changed. If
the state of the overall package has changed, then it will contain an entry
with the package name itself.public static final String EXTRA_CHANGED_PACKAGE_LIST
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
,
ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE
,
ACTION_PACKAGES_SUSPENDED
,
ACTION_PACKAGES_UNSUSPENDED
and contains a string array of all of the components that have changed.public static final String EXTRA_CHANGED_UID_LIST
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
,
ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE
and contains an integer array of uids of all of the components
that have changed.public static final String EXTRA_CLIENT_LABEL
public static final String EXTRA_CLIENT_INTENT
public static final String EXTRA_LOCAL_ONLY
public static final String EXTRA_ALLOW_MULTIPLE
getClipData()
part
of the result Intent.public static final String EXTRA_USER_HANDLE
ACTION_USER_ADDED
,
ACTION_USER_REMOVED
and ACTION_USER_SWITCHED
.public static final String EXTRA_USER
ACTION_MANAGED_PROFILE_ADDED
and ACTION_MANAGED_PROFILE_REMOVED
.public static final String EXTRA_RESTRICTIONS_LIST
ACTION_GET_RESTRICTION_ENTRIES
. The type of the extra is
ArrayList<RestrictionEntry>
.public static final String EXTRA_RESTRICTIONS_BUNDLE
ACTION_GET_RESTRICTION_ENTRIES
. The type of the extra is a Bundle containing
the restrictions as key/value pairs.public static final String EXTRA_RESTRICTIONS_INTENT
ACTION_GET_RESTRICTION_ENTRIES
.public static final String EXTRA_MIME_TYPES
String[]
. Values may be a combination of concrete MIME
types (such as "image/png") and/or partial MIME types (such as
"audio/*").public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY
ACTION_SHUTDOWN
that allows the sender to qualify that
this shutdown is only for the user space of the system, not a complete shutdown.
When this is true, hardware devices can use this information to determine that
they shouldn't do a complete shutdown of their device since this is not a
complete shutdown down to the kernel, but only user space restarting.
The default if not supplied is false.public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT
ACTION_TIME_CHANGED
that indicates the
user has set their time format preferences to the 24 hour format.public static final String EXTRA_REASON
public static final String EXTRA_WIPE_EXTERNAL_STORAGE
public static final String EXTRA_SIM_ACTIVATION_RESPONSE
PendingIntent
extra used to deliver the result of the SIM
activation request.
TODO: Add information about the structure and response data used with the pending intent.public static final String EXTRA_INDEX
The value must be an integer greater or equal to 0.
public static final String EXTRA_QUIET_MODE
public static final String EXTRA_MEDIA_RESOURCE_TYPE
ACTION_MEDIA_RESOURCE_GRANTED
intents to specify the resource type granted. Possible values are
EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC
or
EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC
.public static final int EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC
EXTRA_MEDIA_RESOURCE_TYPE
to represent that a video codec is allowed to use.public static final int EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC
EXTRA_MEDIA_RESOURCE_TYPE
to represent that a audio codec is allowed to use.public static final int FLAG_GRANT_READ_URI_PERMISSION
public static final int FLAG_GRANT_WRITE_URI_PERMISSION
public static final int FLAG_FROM_BACKGROUND
public static final int FLAG_DEBUG_LOG_RESOLUTION
public static final int FLAG_EXCLUDE_STOPPED_PACKAGES
public static final int FLAG_INCLUDE_STOPPED_PACKAGES
FLAG_EXCLUDE_STOPPED_PACKAGES
is not set. If both of these
flags are set, this one wins (it allows overriding of exclude for
places where the framework may automatically set the exclude flag).public static final int FLAG_GRANT_PERSISTABLE_URI_PERMISSION
FLAG_GRANT_READ_URI_PERMISSION
and/or
FLAG_GRANT_WRITE_URI_PERMISSION
, the URI permission grant can be
persisted across device reboots until explicitly revoked with
Context.revokeUriPermission(Uri, int)
. This flag only offers the
grant for possible persisting; the receiving application must call
ContentResolver.takePersistableUriPermission(Uri, int)
to
actually persist.public static final int FLAG_GRANT_PREFIX_URI_PERMISSION
FLAG_GRANT_READ_URI_PERMISSION
and/or
FLAG_GRANT_WRITE_URI_PERMISSION
, the URI permission grant
applies to any URI that is a prefix match against the original granted
URI. (Without this flag, the URI must match exactly for access to be
granted.) Another URI is considered a prefix match only when scheme,
authority, and all path segments defined by the prefix are an exact
match.public static final int FLAG_DEBUG_TRIAGED_MISSING
public static final int FLAG_IGNORE_EPHEMERAL
public static final int FLAG_ACTIVITY_NO_HISTORY
noHistory
attribute.
If set, onActivityResult()
is never invoked when the current activity starts a new activity which
sets a result and finishes.
public static final int FLAG_ACTIVITY_SINGLE_TOP
public static final int FLAG_ACTIVITY_NEW_TASK
This flag is generally used by activities that want to present a "launcher" style behavior: they give the user a list of separate things that can be done, which otherwise run completely independently of the activity launching them.
When using this flag, if a task is already running for the activity
you are now starting, then a new activity will not be started; instead,
the current task will simply be brought to the front of the screen with
the state it was last in. See FLAG_ACTIVITY_MULTIPLE_TASK
for a flag
to disable this behavior.
This flag can not be used when the caller is requesting a result from the activity being launched.
public static final int FLAG_ACTIVITY_MULTIPLE_TASK
FLAG_ACTIVITY_NEW_DOCUMENT
or FLAG_ACTIVITY_NEW_TASK
. In both cases these flags alone would
search through existing tasks for ones matching this Intent. Only if no such
task is found would a new task be created. When paired with
FLAG_ACTIVITY_MULTIPLE_TASK both of these behaviors are modified to skip
the search for a matching task and unconditionally start a new task.
When used with FLAG_ACTIVITY_NEW_TASK
do not use this
flag unless you are implementing your own
top-level application launcher. Used in conjunction with
FLAG_ACTIVITY_NEW_TASK
to disable the
behavior of bringing an existing task to the foreground. When set,
a new task is always started to host the Activity for the
Intent, regardless of whether there is already an existing task running
the same thing.
Because the default system does not include graphical task management,
you should not use this flag unless you provide some way for a user to
return back to the tasks you have launched.
See FLAG_ACTIVITY_NEW_DOCUMENT
for details of this flag's use for
creating new document tasks.
This flag is ignored if one of FLAG_ACTIVITY_NEW_TASK
or
FLAG_ACTIVITY_NEW_DOCUMENT
is not also set.
See Tasks and Back Stack for more information about tasks.
public static final int FLAG_ACTIVITY_CLEAR_TOP
For example, consider a task consisting of the activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of activity B, then C and D will be finished and B receive the given Intent, resulting in the stack now being: A, B.
The currently running instance of activity B in the above example will
either receive the new intent you are starting here in its
onNewIntent() method, or be itself finished and restarted with the
new intent. If it has declared its launch mode to be "multiple" (the
default) and you have not set FLAG_ACTIVITY_SINGLE_TOP
in
the same intent, then it will be finished and re-created; for all other
launch modes or if FLAG_ACTIVITY_SINGLE_TOP
is set then this
Intent will be delivered to the current instance's onNewIntent().
This launch mode can also be used to good effect in conjunction with
FLAG_ACTIVITY_NEW_TASK
: if used to start the root activity
of a task, it will bring any currently running instance of that task
to the foreground, and then clear it to its root state. This is
especially useful, for example, when launching an activity from the
notification manager.
See Tasks and Back Stack for more information about tasks.
public static final int FLAG_ACTIVITY_FORWARD_RESULT
Activity.setResult(int)
and have that result sent back to
the reply target of the original activity.public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP
public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT
launchMode
documentation for the singleTask mode.public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
FLAG_ACTIVITY_NEW_DOCUMENT
which should be used instead of this.public static final int FLAG_ACTIVITY_NEW_DOCUMENT
android.R.attr#documentLaunchMode
multiple instances of the same activity
containing different documents will appear in the recent tasks list.
The use of the activity attribute form of this,
android.R.attr#documentLaunchMode
, is
preferred over the Intent flag described here. The attribute form allows the
Activity to specify multiple document behavior for all launchers of the Activity
whereas using this flag requires each Intent that launches the Activity to specify it.
Note that the default semantics of this flag w.r.t. whether the recents entry for
it is kept after the activity is finished is different than the use of
FLAG_ACTIVITY_NEW_TASK
and android.R.attr#documentLaunchMode
-- if
this flag is being used to create a new recents entry, then by default that entry
will be removed once the activity is finished. You can modify this behavior with
FLAG_ACTIVITY_RETAIN_IN_RECENTS
.
FLAG_ACTIVITY_NEW_DOCUMENT may be used in conjunction with FLAG_ACTIVITY_MULTIPLE_TASK
. When used alone it is the
equivalent of the Activity manifest specifying android.R.attr#documentLaunchMode
="intoExisting". When used with
FLAG_ACTIVITY_MULTIPLE_TASK it is the equivalent of the Activity manifest specifying
android.R.attr#documentLaunchMode
="always".
Refer to android.R.attr#documentLaunchMode
for more information.
android.R.attr#documentLaunchMode
,
FLAG_ACTIVITY_MULTIPLE_TASK
,
Constant Field Valuespublic static final int FLAG_ACTIVITY_NO_USER_ACTION
Activity.onUserLeaveHint()
callback from occurring on the current frontmost activity before it is
paused as the newly-started activity is brought to the front.
Typically, an activity can rely on that callback to indicate that an explicit user action has caused their activity to be moved out of the foreground. The callback marks an appropriate point in the activity's lifecycle for it to dismiss any notifications that it intends to display "until the user has seen them," such as a blinking LED.
If an activity is ever started via any non-user-driven events such as
phone-call receipt or an alarm handler, this flag should be passed to Context.startActivity
, ensuring that the pausing
activity does not think the user has acknowledged its notification.
public static final int FLAG_ACTIVITY_REORDER_TO_FRONT
Context.startActivity()
,
this flag will cause the launched activity to be brought to the front of its
task's history stack if it is already running.
For example, consider a task consisting of four activities: A, B, C, D.
If D calls startActivity() with an Intent that resolves to the component
of activity B, then B will be brought to the front of the history stack,
with this resulting order: A, C, D, B.
This flag will be ignored if FLAG_ACTIVITY_CLEAR_TOP
is also
specified.
public static final int FLAG_ACTIVITY_NO_ANIMATION
Context.startActivity()
,
this flag will prevent the system from applying an activity transition
animation to go to the next activity state. This doesn't mean an
animation will never run -- if another activity change happens that doesn't
specify this flag before the activity started here is displayed, then
that transition will be used. This flag can be put to good use
when you are going to do a series of activity operations but the
animation seen by the user shouldn't be driven by the first activity
change but rather a later one.public static final int FLAG_ACTIVITY_CLEAR_TASK
Context.startActivity()
,
this flag will cause any existing task that would be associated with the
activity to be cleared before the activity is started. That is, the activity
becomes the new root of an otherwise empty task, and any old activities
are finished. This can only be used in conjunction with FLAG_ACTIVITY_NEW_TASK
.public static final int FLAG_ACTIVITY_TASK_ON_HOME
Context.startActivity()
,
this flag will cause a newly launching task to be placed on top of the current
home activity task (if there is one). That is, pressing back from the task
will always return the user to home even if that was not the last activity they
saw. This can only be used in conjunction with FLAG_ACTIVITY_NEW_TASK
.public static final int FLAG_ACTIVITY_RETAIN_IN_RECENTS
FLAG_ACTIVITY_NEW_DOCUMENT
will
have its entry in recent tasks removed when the user closes it (with back
or however else it may finish()). If you would like to instead allow the
document to be kept in recents so that it can be re-launched, you can use
this flag. When set and the task's activity is finished, the recents
entry will remain in the interface for the user to re-launch it, like a
recents entry for a top-level application.
The receiving activity can override this request with
android.R.attr#autoRemoveFromRecents
or by explcitly calling
Activity.finishAndRemoveTask()
.
public static final int FLAG_ACTIVITY_LAUNCH_ADJACENT
FLAG_ACTIVITY_NEW_TASK
. Also, setting FLAG_ACTIVITY_MULTIPLE_TASK
is
required if you want a new instance of an existing activity to be created.public static final int FLAG_RECEIVER_REGISTERED_ONLY
public static final int FLAG_RECEIVER_REPLACE_PENDING
Intent.filterEquals
returning
true for the intents of the two broadcasts. When a match is found,
the new broadcast (and receivers associated with it) will replace the
existing one in the pending broadcast list, remaining at the same
position in the list.
This flag is most typically used with sticky broadcasts, which only care about delivering the most recent values of the broadcast to their receivers.
public static final int FLAG_RECEIVER_FOREGROUND
public static final int FLAG_RECEIVER_NO_ABORT
public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
FLAG_RECEIVER_REGISTERED_ONLY
is specified in the broadcast intent, this flag is unnecessary.
This flag is only for use by system sevices as a convenience to avoid having to implement a more complex mechanism around detection of boot completion.
public static final int FLAG_RECEIVER_BOOT_UPGRADE
public static final int FLAG_RECEIVER_INCLUDE_BACKGROUND
public static final int FLAG_RECEIVER_EXCLUDE_BACKGROUND
public static final int IMMUTABLE_FLAGS
public static final int URI_INTENT_SCHEME
toUri(int)
and parseUri(java.lang.String, int)
: the URI string
always has the "intent:" scheme. This syntax can be used when you want
to later disambiguate between URIs that are intended to describe an
Intent vs. all others that should be treated as raw URIs. When used
with parseUri(java.lang.String, int)
, any other scheme will result in a generic
VIEW action for that raw URI.public static final int URI_ANDROID_APP_SCHEME
toUri(int)
and parseUri(java.lang.String, int)
: the URI string
always has the "android-app:" scheme. This is a variation of
URI_INTENT_SCHEME
whose format is simpler for the case of an
http/https URI being delivered to a specific package name. The format
is:
android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}]
In this scheme, only the package_id
is required. If you include a host,
you must also include a scheme; including a path also requires both a host and a scheme.
The final #Intent; fragment can be used without a scheme, host, or path.
Note that this can not be
used with intents that have a setSelector(android.content.Intent)
, since the base intent
will always have an explicit package name.
Some examples of how this scheme maps to Intent objects:
URI | Intent | ||||||
---|---|---|---|---|---|---|---|
android-app://com.example.app |
|
||||||
android-app://com.example.app/http/example.com |
|
||||||
android-app://com.example.app/http/example.com/foo?1234 |
|
||||||
android-app://com.example.app/ |
|
||||||
android-app://com.example.app/http/example.com/foo?1234 |
|
||||||
android-app://com.example.app/ |
|
public static final int URI_ALLOW_UNSAFE
toUri(int)
and parseUri(java.lang.String, int)
: allow parsing
of unsafe information. In particular, the flags FLAG_GRANT_READ_URI_PERMISSION
,
FLAG_GRANT_WRITE_URI_PERMISSION
, FLAG_GRANT_PERSISTABLE_URI_PERMISSION
,
and FLAG_GRANT_PREFIX_URI_PERMISSION
flags can not be set, so that the
generated Intent can not cause unexpected data access to happen.
If you do not trust the source of the URI being parsed, you should still do further
processing to protect yourself from it. In particular, when using it to start an
activity you should usually add in CATEGORY_BROWSABLE
to limit the activities
that can handle it.
public static final int FILL_IN_ACTION
fillIn(android.content.Intent, int)
to allow the current action value to be
overwritten, even if it is already set.public static final int FILL_IN_DATA
fillIn(android.content.Intent, int)
to allow the current data or type value
overwritten, even if it is already set.public static final int FILL_IN_CATEGORIES
fillIn(android.content.Intent, int)
to allow the current categories to be
overwritten, even if they are already set.public static final int FILL_IN_COMPONENT
fillIn(android.content.Intent, int)
to allow the current component value to be
overwritten, even if it is already set.public static final int FILL_IN_PACKAGE
fillIn(android.content.Intent, int)
to allow the current package value to be
overwritten, even if it is already set.public static final int FILL_IN_SOURCE_BOUNDS
fillIn(android.content.Intent, int)
to allow the current bounds rectangle to be
overwritten, even if it is already set.public static final int FILL_IN_SELECTOR
fillIn(android.content.Intent, int)
to allow the current selector to be
overwritten, even if it is already set.public static final int FILL_IN_CLIP_DATA
fillIn(android.content.Intent, int)
to allow the current ClipData to be
overwritten, even if it is already set.public static final Parcelable.Creator<Intent> CREATOR
public Intent()
public Intent(Intent o)
public Intent(String action)
action
- The Intent action, such as ACTION_VIEW.public Intent(String action, Uri uri)
Note: scheme and host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with these elements using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme and host is lower case.
action
- The Intent action, such as ACTION_VIEW.uri
- The Intent data URI.public Intent(Context packageContext, Class<?> cls)
setComponent(android.content.ComponentName)
for more information on the repercussions of this.packageContext
- A Context of the application package implementing
this class.cls
- The component class that is to be used for the intent.setClass(android.content.Context, java.lang.Class<?>)
,
setComponent(android.content.ComponentName)
,
Intent(String, android.net.Uri , Context, Class)
public Intent(String action, Uri uri, Context packageContext, Class<?> cls)
Intent(String, android.net.Uri)
to
construct the Intent and then calling setClass(android.content.Context, java.lang.Class<?>)
to set its
class.
Note: scheme and host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with these elements using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme and host is lower case.
action
- The Intent action, such as ACTION_VIEW.uri
- The Intent data URI.packageContext
- A Context of the application package implementing
this class.cls
- The component class that is to be used for the intent.Intent(String, android.net.Uri)
,
Intent(Context, Class)
,
setClass(android.content.Context, java.lang.Class<?>)
,
setComponent(android.content.ComponentName)
protected Intent(Parcel in)
public static Intent createChooser(Intent target, CharSequence title)
ACTION_CHOOSER
Intent.
Builds a new ACTION_CHOOSER
Intent that wraps the given
target intent, also optionally supplying a title. If the target
intent has specified FLAG_GRANT_READ_URI_PERMISSION
or
FLAG_GRANT_WRITE_URI_PERMISSION
, then these flags will also be
set in the returned chooser intent, with its ClipData set appropriately:
either a direct reflection of getClipData()
if that is non-null,
or a new ClipData built from getData()
.
target
- The Intent that the user will be selecting an activity
to perform.title
- Optional title that will be displayed in the chooser.Context.startActivity()
and
related methods.public static Intent createChooser(Intent target, CharSequence title, IntentSender sender)
ACTION_CHOOSER
Intent.
Builds a new ACTION_CHOOSER
Intent that wraps the given
target intent, also optionally supplying a title. If the target
intent has specified FLAG_GRANT_READ_URI_PERMISSION
or
FLAG_GRANT_WRITE_URI_PERMISSION
, then these flags will also be
set in the returned chooser intent, with its ClipData set appropriately:
either a direct reflection of getClipData()
if that is non-null,
or a new ClipData built from getData()
.
The caller may optionally supply an IntentSender
to receive a callback
when the user makes a choice. This can be useful if the calling application wants
to remember the last chosen target and surface it as a more prominent or one-touch
affordance elsewhere in the UI for next time.
target
- The Intent that the user will be selecting an activity
to perform.title
- Optional title that will be displayed in the chooser.sender
- Optional IntentSender to be called when a choice is made.Context.startActivity()
and
related methods.public static boolean isAccessUriMode(int modeFlags)
public Object clone()
Object
x
, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true
, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x)
true
, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone
. If a class and all of its superclasses (except
Object
) obey this convention, it will be the case that
x.clone().getClass() == x.getClass()
.
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone
before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
The method clone
for class Object
performs a
specific cloning operation. First, if the class of this object does
not implement the interface Cloneable
, then a
CloneNotSupportedException
is thrown. Note that all arrays
are considered to implement the interface Cloneable
and that
the return type of the clone
method of an array type T[]
is T[]
where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object
does not itself implement the interface
Cloneable
, so calling the clone
method on an object
whose class is Object
will result in throwing an
exception at run time.
public Intent cloneFilter()
public static Intent makeMainActivity(ComponentName mainActivity)
The returned Intent has the given Activity component as its explicit
component, ACTION_MAIN
as its action, and includes the
category CATEGORY_LAUNCHER
. This does not have
FLAG_ACTIVITY_NEW_TASK
set, though typically you will want
to do that through addFlags(int)
on the returned Intent.
mainActivity
- The main activity component that this Intent will
launch.setClass(android.content.Context, java.lang.Class<?>)
,
setComponent(android.content.ComponentName)
public static Intent makeMainSelectorActivity(String selectorAction, String selectorCategory)
The returned Intent has ACTION_MAIN
as its action, and includes the
category CATEGORY_LAUNCHER
. This does not have
FLAG_ACTIVITY_NEW_TASK
set, though typically you will want
to do that through addFlags(int)
on the returned Intent.
selectorAction
- The action name of the Intent's selector.selectorCategory
- The name of a category to add to the Intent's
selector.setSelector(Intent)
public static Intent makeRestartActivityTask(ComponentName mainActivity)
makeMainActivity(ComponentName)
,
but also sets the flags FLAG_ACTIVITY_NEW_TASK
and
FLAG_ACTIVITY_CLEAR_TASK
.mainActivity
- The activity component that is the root of the
task; this is the activity that has been published in the application's
manifest as the main launcher icon.@Deprecated public static Intent getIntent(String uri) throws URISyntaxException
parseUri(java.lang.String, int)
instead.parseUri(java.lang.String, int)
with 0 flags.URISyntaxException
public static Intent parseUri(String uri, int flags) throws URISyntaxException
toUri(int)
. If the Intent was not generate by toUri(), its data
will be the entire URI and its action will be ACTION_VIEW.
The URI given here must not be relative -- that is, it must include the scheme and full path.
uri
- The URI to turn into an Intent.flags
- Additional processing flags. Either 0,
URI_INTENT_SCHEME
, or URI_ANDROID_APP_SCHEME
.URISyntaxException
- Throws URISyntaxError if the basic URI syntax
it bad (as parsed by the Uri class) or the Intent data within the
URI is invalid.toUri(int)
public static Intent getIntentOld(String uri) throws URISyntaxException
URISyntaxException
public static Intent parseCommandArgs(ShellCommand cmd, Intent.CommandOptionHandler optionHandler) throws URISyntaxException
URISyntaxException
public static void printIntentArgsHelp(PrintWriter pw, String prefix)
public String getAction()
ACTION_VIEW
. The action describes the general way the rest of
the information in the intent should be interpreted -- most importantly,
what to do with the data returned by getData()
.setAction(java.lang.String)
public Uri getData()
getScheme()
,
setData(android.net.Uri)
public String getDataString()
getData()
, but returns the URI as an encoded
String.public String getScheme()
This is the same as calling getData().getScheme() (and checking for null data).
getData()
public String getType()
resolveType(ContentResolver)
,
setType(java.lang.String)
public String resolveType(Context context)
getType()
,
resolveType(ContentResolver)
public String resolveType(ContentResolver resolver)
resolver
- A ContentResolver that can be used to determine the MIME
type of the intent's data.getType()
,
resolveType(Context)
public String resolveTypeIfNeeded(ContentResolver resolver)
resolver
- A ContentResolver that can be used to determine the MIME
type of the intent's data.public boolean hasCategory(String category)
category
- The category to check.getCategories()
,
addCategory(java.lang.String)
public Set<String> getCategories()
hasCategory(java.lang.String)
,
addCategory(java.lang.String)
public Intent getSelector()
setSelector(android.content.Intent)
for more information.setSelector(android.content.Intent)
public ClipData getClipData()
ClipData
associated with this Intent. If there is
none, returns null. See setClipData(android.content.ClipData)
for more information.setClipData(android.content.ClipData)
public int getContentUserHint()
public void setExtrasClassLoader(ClassLoader loader)
loader
- a ClassLoader, or null to use the default loader
at the time of unmarshalling.public boolean hasExtra(String name)
name
- the extra's namepublic boolean hasFileDescriptors()
public void setAllowFds(boolean allowFds)
public void setDefusable(boolean defusable)
@Deprecated public Object getExtra(String name)
name
- The name of the desired item.public boolean getBooleanExtra(String name, boolean defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, boolean)
public byte getByteExtra(String name, byte defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, byte)
public short getShortExtra(String name, short defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, short)
public char getCharExtra(String name, char defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, char)
public int getIntExtra(String name, int defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, int)
public long getLongExtra(String name, long defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, long)
public float getFloatExtra(String name, float defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, float)
public double getDoubleExtra(String name, double defaultValue)
name
- The name of the desired item.defaultValue
- the value to be returned if no value of the desired
type is stored with the given name.putExtra(String, double)
public String getStringExtra(String name)
name
- The name of the desired item.putExtra(String, String)
public CharSequence getCharSequenceExtra(String name)
name
- The name of the desired item.putExtra(String, CharSequence)
public <T extends Parcelable> T getParcelableExtra(String name)
name
- The name of the desired item.putExtra(String, Parcelable)
public Parcelable[] getParcelableArrayExtra(String name)
name
- The name of the desired item.putExtra(String, Parcelable[])
public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name)
name
- The name of the desired item.putParcelableArrayListExtra(String, ArrayList)
public Serializable getSerializableExtra(String name)
name
- The name of the desired item.putExtra(String, Serializable)
public ArrayList<Integer> getIntegerArrayListExtra(String name)
name
- The name of the desired item.putIntegerArrayListExtra(String, ArrayList)
public ArrayList<String> getStringArrayListExtra(String name)
name
- The name of the desired item.putStringArrayListExtra(String, ArrayList)
public ArrayList<CharSequence> getCharSequenceArrayListExtra(String name)
name
- The name of the desired item.putCharSequenceArrayListExtra(String, ArrayList)
public boolean[] getBooleanArrayExtra(String name)
name
- The name of the desired item.putExtra(String, boolean[])
public byte[] getByteArrayExtra(String name)
name
- The name of the desired item.putExtra(String, byte[])
public short[] getShortArrayExtra(String name)
name
- The name of the desired item.putExtra(String, short[])
public char[] getCharArrayExtra(String name)
name
- The name of the desired item.putExtra(String, char[])
public int[] getIntArrayExtra(String name)
name
- The name of the desired item.putExtra(String, int[])
public long[] getLongArrayExtra(String name)
name
- The name of the desired item.putExtra(String, long[])
public float[] getFloatArrayExtra(String name)
name
- The name of the desired item.putExtra(String, float[])
public double[] getDoubleArrayExtra(String name)
name
- The name of the desired item.putExtra(String, double[])
public String[] getStringArrayExtra(String name)
name
- The name of the desired item.putExtra(String, String[])
public CharSequence[] getCharSequenceArrayExtra(String name)
name
- The name of the desired item.putExtra(String, CharSequence[])
public Bundle getBundleExtra(String name)
name
- The name of the desired item.putExtra(String, Bundle)
@Deprecated public IBinder getIBinderExtra(String name)
name
- The name of the desired item.putExtra(String, IBinder)
@Deprecated public Object getExtra(String name, Object defaultValue)
name
- The name of the desired item.defaultValue
- The default value to return in case no item is
associated with the key 'name'putExtra(java.lang.String, boolean)
public Bundle getExtras()
public void removeUnsafeExtras()
public int getFlags()
setFlags(int)
and let the system
take the appropriate action with them.setFlags(int)
public boolean isExcludingStopped()
public String getPackage()
resolveActivity(android.content.pm.PackageManager)
,
setPackage(java.lang.String)
public ComponentName getComponent()
resolveActivity(android.content.pm.PackageManager)
,
setComponent(android.content.ComponentName)
public Rect getSourceBounds()
public ComponentName resolveActivity(PackageManager pm)
If getComponent()
returns an explicit class, that is returned
without any further consideration.
The activity must handle the CATEGORY_DEFAULT
Intent
category to be considered.
If getAction()
is non-NULL, the activity must handle this
action.
If resolveType(android.content.Context)
returns non-NULL, the activity must handle
this type.
If addCategory(java.lang.String)
has added any categories, the activity must
handle ALL of the categories specified.
If getPackage()
is non-NULL, only activity components in
that application package will be considered.
If there are no activities that satisfy all of these conditions, a null string is returned.
If multiple activities are found to satisfy the intent, the one with the highest priority will be used. If there are multiple activities with the same priority, the system will either pick the best activity based on user preference, or resolve to a system class that will allow the user to pick an activity and forward from there.
This method is implemented simply by calling
PackageManager.resolveActivity(android.content.Intent, int)
with the "defaultOnly" parameter
true.
This API is called for you as part of starting an activity from an intent. You do not normally need to call it yourself.
pm
- The package manager with which to resolve the Intent.setComponent(android.content.ComponentName)
,
getComponent()
,
resolveActivityInfo(android.content.pm.PackageManager, int)
public ActivityInfo resolveActivityInfo(PackageManager pm, int flags)
ActivityInfo
describing the activity that should execute the intent. Resolution
follows the same rules as described for resolveActivity(android.content.pm.PackageManager)
, but
you get back the completely information about the resolved activity
instead of just its class name.pm
- The package manager with which to resolve the Intent.flags
- Addition information to retrieve as per
PackageManager.getActivityInfo()
.resolveActivity(android.content.pm.PackageManager)
public ComponentName resolveSystemService(PackageManager pm, int flags)
public Intent setAction(String action)
action
- An action name, such as ACTION_VIEW. Application-specific
actions should be prefixed with the vendor's package name.getAction()
public Intent setData(Uri data)
setType(java.lang.String)
or
setTypeAndNormalize(java.lang.String)
.
Note: scheme matching in the Android framework is
case-sensitive, unlike the formal RFC. As a result,
you should always write your Uri with a lower case scheme,
or use Uri.normalizeScheme()
or
setDataAndNormalize(android.net.Uri)
to ensure that the scheme is converted to lower case.
data
- The Uri of the data this intent is now targeting.getData()
,
setDataAndNormalize(android.net.Uri)
,
Uri.normalizeScheme()
public Intent setDataAndNormalize(Uri data)
This method automatically clears any type that was
previously set (for example, by setType(java.lang.String)
).
The data Uri is normalized using
Uri.normalizeScheme()
before it is set,
so really this is just a convenience method for
setData(data.normalize())
data
- The Uri of the data this intent is now targeting.getData()
,
setType(java.lang.String)
,
Uri.normalizeScheme()
public Intent setType(String type)
This is used to create intents that only specify a type and not data, for example to indicate the type of data to return.
This method automatically clears any data that was
previously set (for example by setData(android.net.Uri)
).
Note: MIME type matching in the Android framework is
case-sensitive, unlike formal RFC MIME types. As a result,
you should always write your MIME types with lower case letters,
or use normalizeMimeType(java.lang.String)
or setTypeAndNormalize(java.lang.String)
to ensure that it is converted to lower case.
type
- The MIME type of the data being handled by this intent.getType()
,
setTypeAndNormalize(java.lang.String)
,
setDataAndType(android.net.Uri, java.lang.String)
,
normalizeMimeType(java.lang.String)
public Intent setTypeAndNormalize(String type)
This is used to create intents that only specify a type and not data, for example to indicate the type of data to return.
This method automatically clears any data that was
previously set (for example by setData(android.net.Uri)
).
The MIME type is normalized using
normalizeMimeType(java.lang.String)
before it is set,
so really this is just a convenience method for
setType(Intent.normalizeMimeType(type))
type
- The MIME type of the data being handled by this intent.getType()
,
setData(android.net.Uri)
,
normalizeMimeType(java.lang.String)
public Intent setDataAndType(Uri data, String type)
Note: MIME type and Uri scheme matching in the
Android framework is case-sensitive, unlike the formal RFC definitions.
As a result, you should always write these elements with lower case letters,
or use normalizeMimeType(java.lang.String)
or Uri.normalizeScheme()
or
setDataAndTypeAndNormalize(android.net.Uri, java.lang.String)
to ensure that they are converted to lower case.
data
- The Uri of the data this intent is now targeting.type
- The MIME type of the data being handled by this intent.setType(java.lang.String)
,
setData(android.net.Uri)
,
normalizeMimeType(java.lang.String)
,
Uri.normalizeScheme()
,
setDataAndTypeAndNormalize(android.net.Uri, java.lang.String)
public Intent setDataAndTypeAndNormalize(Uri data, String type)
The data Uri and the MIME type are normalize using
Uri.normalizeScheme()
and normalizeMimeType(java.lang.String)
before they are set, so really this is just a convenience method for
setDataAndType(data.normalize(), Intent.normalizeMimeType(type))
data
- The Uri of the data this intent is now targeting.type
- The MIME type of the data being handled by this intent.setType(java.lang.String)
,
setData(android.net.Uri)
,
setDataAndType(android.net.Uri, java.lang.String)
,
normalizeMimeType(java.lang.String)
,
Uri.normalizeScheme()
public Intent addCategory(String category)
category
- The desired category. This can be either one of the
predefined Intent categories, or a custom category in your own
namespace.hasCategory(java.lang.String)
,
removeCategory(java.lang.String)
public void removeCategory(String category)
category
- The category to remove.addCategory(java.lang.String)
public void setSelector(Intent selector)
An example of where this may be used is with things like
CATEGORY_APP_BROWSER
. This category allows you to build an
Intent that will launch the Browser application. However, the correct
main entry point of an application is actually ACTION_MAIN
CATEGORY_LAUNCHER
with setComponent(ComponentName)
used to specify the actual Activity to launch. If you launch the browser
with something different, undesired behavior may happen if the user has
previously or later launches it the normal way, since they do not match.
Instead, you can build an Intent with the MAIN action (but no ComponentName
yet specified) and set a selector with ACTION_MAIN
and
CATEGORY_APP_BROWSER
to point it specifically to the browser activity.
Setting a selector does not impact the behavior of
filterEquals(Intent)
and filterHashCode()
. This is part of the
desired behavior of a selector -- it does not impact the base meaning
of the Intent, just what kinds of things will be matched against it
when determining who can handle it.
You can not use both a selector and setPackage(String)
on
the same base Intent.
selector
- The desired selector Intent; set to null to not use
a special selector.public void setClipData(ClipData clip)
ClipData
associated with this Intent. This replaces any
previously set ClipData.
The ClipData in an intent is not used for Intent matching or other
such operations. Semantically it is like extras, used to transmit
additional data with the Intent. The main feature of using this over
the extras for data is that FLAG_GRANT_READ_URI_PERMISSION
and FLAG_GRANT_WRITE_URI_PERMISSION
will operate on any URI
items included in the clip data. This is useful, in particular, if
you want to transmit an Intent containing multiple content:
URIs for which the recipient may not have global permission to access the
content provider.
If the ClipData contains items that are themselves Intents, any grant flags in those Intents will be ignored. Only the top-level flags of the main Intent are respected, and will be applied to all Uri or Intent items in the clip (or sub-items of the clip).
The MIME type, label, and icon in the ClipData object are not directly used by Intent. Applications should generally rely on the MIME type of the Intent itself, not what it may find in the ClipData. A common practice is to construct a ClipData for use with an Intent with a MIME type of "*/*".
clip
- The new clip to set. May be null to clear the current clip.public void prepareToLeaveUser(int userId)
public Intent putExtra(String name, boolean value)
name
- The name of the extra data, with package prefix.value
- The boolean data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getBooleanExtra(String, boolean)
public Intent putExtra(String name, byte value)
name
- The name of the extra data, with package prefix.value
- The byte data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getByteExtra(String, byte)
public Intent putExtra(String name, char value)
name
- The name of the extra data, with package prefix.value
- The char data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getCharExtra(String, char)
public Intent putExtra(String name, short value)
name
- The name of the extra data, with package prefix.value
- The short data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getShortExtra(String, short)
public Intent putExtra(String name, int value)
name
- The name of the extra data, with package prefix.value
- The integer data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getIntExtra(String, int)
public Intent putExtra(String name, long value)
name
- The name of the extra data, with package prefix.value
- The long data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getLongExtra(String, long)
public Intent putExtra(String name, float value)
name
- The name of the extra data, with package prefix.value
- The float data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getFloatExtra(String, float)
public Intent putExtra(String name, double value)
name
- The name of the extra data, with package prefix.value
- The double data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getDoubleExtra(String, double)
public Intent putExtra(String name, String value)
name
- The name of the extra data, with package prefix.value
- The String data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getStringExtra(String)
public Intent putExtra(String name, CharSequence value)
name
- The name of the extra data, with package prefix.value
- The CharSequence data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getCharSequenceExtra(String)
public Intent putExtra(String name, Parcelable value)
name
- The name of the extra data, with package prefix.value
- The Parcelable data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getParcelableExtra(String)
public Intent putExtra(String name, Parcelable[] value)
name
- The name of the extra data, with package prefix.value
- The Parcelable[] data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getParcelableArrayExtra(String)
public Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value)
name
- The name of the extra data, with package prefix.value
- The ArrayListputExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getParcelableArrayListExtra(String)
public Intent putIntegerArrayListExtra(String name, ArrayList<Integer> value)
name
- The name of the extra data, with package prefix.value
- The ArrayListputExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getIntegerArrayListExtra(String)
public Intent putStringArrayListExtra(String name, ArrayList<String> value)
name
- The name of the extra data, with package prefix.value
- The ArrayListputExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getStringArrayListExtra(String)
public Intent putCharSequenceArrayListExtra(String name, ArrayList<CharSequence> value)
name
- The name of the extra data, with package prefix.value
- The ArrayListputExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getCharSequenceArrayListExtra(String)
public Intent putExtra(String name, Serializable value)
name
- The name of the extra data, with package prefix.value
- The Serializable data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getSerializableExtra(String)
public Intent putExtra(String name, boolean[] value)
name
- The name of the extra data, with package prefix.value
- The boolean array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getBooleanArrayExtra(String)
public Intent putExtra(String name, byte[] value)
name
- The name of the extra data, with package prefix.value
- The byte array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getByteArrayExtra(String)
public Intent putExtra(String name, short[] value)
name
- The name of the extra data, with package prefix.value
- The short array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getShortArrayExtra(String)
public Intent putExtra(String name, char[] value)
name
- The name of the extra data, with package prefix.value
- The char array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getCharArrayExtra(String)
public Intent putExtra(String name, int[] value)
name
- The name of the extra data, with package prefix.value
- The int array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getIntArrayExtra(String)
public Intent putExtra(String name, long[] value)
name
- The name of the extra data, with package prefix.value
- The byte array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getLongArrayExtra(String)
public Intent putExtra(String name, float[] value)
name
- The name of the extra data, with package prefix.value
- The float array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getFloatArrayExtra(String)
public Intent putExtra(String name, double[] value)
name
- The name of the extra data, with package prefix.value
- The double array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getDoubleArrayExtra(String)
public Intent putExtra(String name, String[] value)
name
- The name of the extra data, with package prefix.value
- The String array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getStringArrayExtra(String)
public Intent putExtra(String name, CharSequence[] value)
name
- The name of the extra data, with package prefix.value
- The CharSequence array data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getCharSequenceArrayExtra(String)
public Intent putExtra(String name, Bundle value)
name
- The name of the extra data, with package prefix.value
- The Bundle data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getBundleExtra(String)
@Deprecated public Intent putExtra(String name, IBinder value)
name
- The name of the extra data, with package prefix.value
- The IBinder data value.putExtras(android.content.Intent)
,
removeExtra(java.lang.String)
,
getIBinderExtra(String)
public Intent putExtras(Intent src)
src
- Contains the extras to copy.putExtra(java.lang.String, boolean)
public Intent putExtras(Bundle extras)
extras
- The Bundle of extras to add to this intent.putExtra(java.lang.String, boolean)
,
removeExtra(java.lang.String)
public Intent replaceExtras(Intent src)
src
- The exact extras contained in this Intent are copied
into the target intent, replacing any that were previously there.public Intent replaceExtras(Bundle extras)
extras
- The new set of extras in the Intent, or null to erase
all extras.public void removeExtra(String name)
putExtra(java.lang.String, boolean)
public Intent setFlags(int flags)
Context.startActivity()
and the
FLAG_RECEIVER_* flags are all for use with
Context.sendBroadcast()
.
See the Tasks and Back Stack documentation for important information on how some of these options impact the behavior of your application.
flags
- The desired flags.getFlags()
,
addFlags(int)
,
FLAG_GRANT_READ_URI_PERMISSION
,
FLAG_GRANT_WRITE_URI_PERMISSION
,
FLAG_GRANT_PERSISTABLE_URI_PERMISSION
,
FLAG_GRANT_PREFIX_URI_PERMISSION
,
FLAG_DEBUG_LOG_RESOLUTION
,
FLAG_FROM_BACKGROUND
,
FLAG_ACTIVITY_BROUGHT_TO_FRONT
,
FLAG_ACTIVITY_CLEAR_TASK
,
FLAG_ACTIVITY_CLEAR_TOP
,
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
,
FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
,
FLAG_ACTIVITY_FORWARD_RESULT
,
FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
,
FLAG_ACTIVITY_MULTIPLE_TASK
,
FLAG_ACTIVITY_NEW_DOCUMENT
,
FLAG_ACTIVITY_NEW_TASK
,
FLAG_ACTIVITY_NO_ANIMATION
,
FLAG_ACTIVITY_NO_HISTORY
,
FLAG_ACTIVITY_NO_USER_ACTION
,
FLAG_ACTIVITY_PREVIOUS_IS_TOP
,
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
,
FLAG_ACTIVITY_REORDER_TO_FRONT
,
FLAG_ACTIVITY_SINGLE_TOP
,
FLAG_ACTIVITY_TASK_ON_HOME
,
FLAG_RECEIVER_REGISTERED_ONLY
public Intent addFlags(int flags)
flags
- The new flags to set.setFlags(int)
public Intent setPackage(String packageName)
packageName
- The name of the application package to handle the
intent, or null to allow any application package.getPackage()
,
resolveActivity(android.content.pm.PackageManager)
public Intent setComponent(ComponentName component)
component
- The name of the application component to handle the
intent, or null to let the system find one for you.setClass(android.content.Context, java.lang.Class<?>)
,
setClassName(Context, String)
,
setClassName(String, String)
,
getComponent()
,
resolveActivity(android.content.pm.PackageManager)
public Intent setClassName(Context packageContext, String className)
setComponent(android.content.ComponentName)
with an
explicit class name.packageContext
- A Context of the application package implementing
this class.className
- The name of a class inside of the application package
that will be used as the component for this Intent.setComponent(android.content.ComponentName)
,
setClass(android.content.Context, java.lang.Class<?>)
public Intent setClassName(String packageName, String className)
setComponent(android.content.ComponentName)
with an
explicit application package name and class name.packageName
- The name of the package implementing the desired
component.className
- The name of a class inside of the application package
that will be used as the component for this Intent.setComponent(android.content.ComponentName)
,
setClass(android.content.Context, java.lang.Class<?>)
public Intent setClass(Context packageContext, Class<?> cls)
setComponent(ComponentName)
with the
name returned by a Class
object.packageContext
- A Context of the application package implementing
this class.cls
- The class name to set, equivalent to
setClassName(context, cls.getName())
.setComponent(android.content.ComponentName)
public void setSourceBounds(Rect r)
public int fillIn(Intent other, int flags)
setAction(java.lang.String)
.
setData(Uri)
,
setType(String)
, or setDataAndType(Uri, String)
.
addCategory(java.lang.String)
.
setPackage(java.lang.String)
.
setComponent(ComponentName)
or
related methods.
setSourceBounds(android.graphics.Rect)
.
setSelector(Intent)
.
setClipData(ClipData)
.
In addition, you can use the FILL_IN_ACTION
,
FILL_IN_DATA
, FILL_IN_CATEGORIES
, FILL_IN_PACKAGE
,
FILL_IN_COMPONENT
, FILL_IN_SOURCE_BOUNDS
,
FILL_IN_SELECTOR
, and FILL_IN_CLIP_DATA
to override
the restriction where the corresponding field will not be replaced if
it is already set.
Note: The component field will only be copied if FILL_IN_COMPONENT
is explicitly specified. The selector will only be copied if
FILL_IN_SELECTOR
is explicitly specified.
For example, consider Intent A with {data="foo", categories="bar"} and Intent B with {action="gotit", data-type="some/thing", categories="one","two"}.
Calling A.fillIn(B, Intent.FILL_IN_DATA) will result in A now containing: {action="gotit", data-type="some/thing", categories="bar"}.
other
- Another Intent whose values are to be used to fill in
the current one.flags
- Options to control which fields can be filled in.FILL_IN_ACTION
,
FILL_IN_DATA
, FILL_IN_CATEGORIES
, FILL_IN_PACKAGE
,
FILL_IN_COMPONENT
, FILL_IN_SOURCE_BOUNDS
,
FILL_IN_SELECTOR
and {@link #FILL_IN_CLIP_DATA indicating which fields were
changed.public boolean filterEquals(Intent other)
other
- The other Intent to compare against.public int filterHashCode()
filterEquals(android.content.Intent)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public String toInsecureString()
public String toInsecureStringWithClip()
public String toShortString(boolean secure, boolean comp, boolean extras, boolean clip)
public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras, boolean clip)
@Deprecated public String toURI()
toUri(int)
instead.toUri(int)
with 0 flags.public String toUri(int flags)
Uri.parse(String)
. The URI contains the
Intent's data as the base URI, with an additional fragment describing
the action, categories, type, flags, package, component, and extras.
You can convert the returned string back to an Intent with
getIntent(java.lang.String)
.
flags
- Additional operating flags. Either 0,
URI_INTENT_SCHEME
, or URI_ANDROID_APP_SCHEME
.public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel out, int flags)
Parcelable
writeToParcel
in interface Parcelable
out
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public void readFromParcel(Parcel in)
public static Intent parseIntent(Resources resources, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException
resources
- The Resources to use when inflating resources.parser
- The XML parser pointing at an "intent" tag.attrs
- The AttributeSet interface for retrieving extended
attribute data at the current parser location.XmlPullParserException
- If there was an XML parsing error.IOException
- If there was an I/O error.public void saveToXml(XmlSerializer out) throws IOException
IOException
public static Intent restoreFromXml(XmlPullParser in) throws IOException, XmlPullParserException
IOException
XmlPullParserException
public static String normalizeMimeType(String type)
A normalized MIME type has white-space trimmed, content-type parameters removed, and is lower-case. This aligns the type with Android best practices for intent filtering.
For example, "text/plain; charset=utf-8" becomes "text/plain". "text/x-vCard" becomes "text/x-vcard".
All MIME types received from outside Android (such as user input, or external sources like Bluetooth, NFC, or the Internet) should be normalized before they are used to create an Intent.
type
- MIME data type to normalizesetType(java.lang.String)
,
setTypeAndNormalize(java.lang.String)
public void prepareToLeaveProcess(Context context)
Intent
to leave an app process.public void prepareToLeaveProcess(boolean leavingPackage)
Intent
to leave an app process.public void prepareToEnterProcess()
public void fixUris(int contentUserHint)
public boolean migrateExtraStreamToClipData()
EXTRA_STREAM
in ACTION_SEND
and
ACTION_SEND_MULTIPLE
to ClipData
. Also inspects nested
intents in ACTION_CHOOSER
.public boolean isDocument()