Intent.java revision 21f1bd17b2dfe361acbb28453b3f3b1a110932fa
149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes/* 249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Copyright (C) 2006 The Android Open Source Project 349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Licensed under the Apache License, Version 2.0 (the "License"); 549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * you may not use this file except in compliance with the License. 649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * You may obtain a copy of the License at 749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * http://www.apache.org/licenses/LICENSE-2.0 949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 1049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Unless required by applicable law or agreed to in writing, software 1149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * distributed under the License is distributed on an "AS IS" BASIS, 1249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * See the License for the specific language governing permissions and 1449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * limitations under the License. 1549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 1649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 1749c78900da0d43140fb602431fb93212bd7f6c70Chris Banespackage android.content; 1849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 1949c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport org.xmlpull.v1.XmlPullParser; 20c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banesimport org.xmlpull.v1.XmlPullParserException; 2149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 22c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banesimport android.annotation.SdkConstant; 2349c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.annotation.SdkConstant.SdkConstantType; 2449c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.content.pm.ActivityInfo; 2549c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.content.pm.PackageManager; 2649c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.content.pm.ResolveInfo; 2770acb0c19be3831a2080e4f902324de16bfbf62eTor Norbyeimport android.content.res.Resources; 28f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbyeimport android.content.res.TypedArray; 297325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banesimport android.graphics.Rect; 307325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banesimport android.net.Uri; 31ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sappersteinimport android.os.Bundle; 32f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbyeimport android.os.IBinder; 33f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbyeimport android.os.Parcel; 3449c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.os.Parcelable; 3549c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.util.AttributeSet; 36ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banesimport android.util.Log; 37ca4128f292d30374103de848a5805171d9a5a186Adam Powellimport com.android.common.XmlUtils; 3849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 3949c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.io.IOException; 4049c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.io.Serializable; 41c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banesimport java.net.URISyntaxException; 4249c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.util.ArrayList; 4349c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.util.HashSet; 4449c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.util.Iterator; 4549c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.util.Set; 4649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 4749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes/** 4849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * An intent is an abstract description of an operation to be performed. It 4949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * can be used with {@link Context#startActivity(Intent) startActivity} to 50c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * launch an {@link android.app.Activity}, 51b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * {@link android.content.Context#sendBroadcast(Intent) broadcastIntent} to 52469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * send it to any interested {@link BroadcastReceiver BroadcastReceiver} components, 5349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and {@link android.content.Context#startService} or 5449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link android.content.Context#bindService} to communicate with a 5549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * background {@link android.app.Service}. 5649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 5749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>An Intent provides a facility for performing late runtime binding between 5849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the code in different applications. Its most significant use is in the 5949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * launching of activities, where it can be thought of as the glue between 6049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activities. It is 6149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * basically a passive data structure holding an abstract description of an 6249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * action to be performed. The primary pieces of information in an intent 6349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * are:</p> 64ca4128f292d30374103de848a5805171d9a5a186Adam Powell * 6549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 6649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>action</b> -- The general action to be performed, such as 6749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #ACTION_VIEW}, {@link #ACTION_EDIT}, {@link #ACTION_MAIN}, 6849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * etc.</p> 6949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 7049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>data</b> -- The data to operate on, such as a person record 7149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * in the contacts database, expressed as a {@link android.net.Uri}.</p> 7249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 7349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 7449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 7549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 7649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Some examples of action/data pairs are:</p> 7749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 7849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 7949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_VIEW} <i>content://contacts/people/1</i></b> -- Display 8049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * information about the person whose identifier is "1".</p> 8149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 82f3ad1351d8b40ec5defe35e79d3430ad3c384b6dChris Banes * <li> <p><b>{@link #ACTION_DIAL} <i>content://contacts/people/1</i></b> -- Display 8349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the phone dialer with the person filled in.</p> 8449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 8549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_VIEW} <i>tel:123</i></b> -- Display 8649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the phone dialer with the given number filled in. Note how the 8749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * VIEW action does what what is considered the most reasonable thing for 8849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a particular URI.</p> 8949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 9049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_DIAL} <i>tel:123</i></b> -- Display 9149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the phone dialer with the given number filled in.</p> 927325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * </li> 937325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * <li> <p><b>{@link #ACTION_EDIT} <i>content://contacts/people/1</i></b> -- Edit 947325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * information about the person whose identifier is "1".</p> 9549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 9649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_VIEW} <i>content://contacts/people/</i></b> -- Display 9749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a list of people, which the user can browse through. This example is a 9849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * typical top-level entry into the Contacts application, showing you the 9949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * list of people. Selecting a particular person to view would result in a 10049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * new intent { <b>{@link #ACTION_VIEW} <i>content://contacts/N</i></b> } 10149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * being used to start an activity to display that person.</p> 10249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 10349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 10449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 10549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>In addition to these primary attributes, there are a number of secondary 10649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * attributes that you can also include with an intent:</p> 10749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 10849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 10949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>category</b> -- Gives additional information about the action 1107325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * to execute. For example, {@link #CATEGORY_LAUNCHER} means it should 1117325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * appear in the Launcher as a top-level application, while 1127325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * {@link #CATEGORY_ALTERNATIVE} means it should be included in a list 11349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of alternative actions the user can perform on a piece of data.</p> 11449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>type</b> -- Specifies an explicit type (a MIME type) of the 11549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * intent data. Normally the type is inferred from the data itself. 11649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * By setting this attribute, you disable that evaluation and force 11749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * an explicit type.</p> 11849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>component</b> -- Specifies an explicit name of a component 11949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * class to use for the intent. Normally this is determined by looking 12049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * at the other information in the intent (the action, data/type, and 12149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * categories) and matching that with a component that can handle it. 12249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * If this attribute is set then none of the evaluation is performed, 12349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and this component is used exactly as is. By specifying this attribute, 12449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * all of the other Intent attributes become optional.</p> 12549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>extras</b> -- This is a {@link Bundle} of any additional information. 1267325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * This can be used to provide extended information to the component. 12749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * For example, if we have a action to send an e-mail message, we could 12849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * also include extra pieces of data here to supply a subject, body, 12949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * etc.</p> 1303e2b5bd049c924bf6d29615973bc598a6d50e6cbAlan Viverette * </ul> 1317325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * 13249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Here are some examples of other operations you can specify as intents 13349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * using these additional parameters:</p> 13449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 13549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 13649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_MAIN} with category {@link #CATEGORY_HOME}</b> -- 13749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Launch the home screen.</p> 13849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 13949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type 14049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <i>{@link android.provider.Contacts.Phones#CONTENT_URI 14149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * vnd.android.cursor.item/phone}</i></b> 14249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * -- Display the list of people's phone numbers, allowing the user to 14349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * browse through them and pick one and return it to the parent activity.</p> 14449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 14549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type 14649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <i>*{@literal /}*</i> and category {@link #CATEGORY_OPENABLE}</b> 14749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * -- Display all pickers for data that can be opened with 14849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link ContentResolver#openInputStream(Uri) ContentResolver.openInputStream()}, 14949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * allowing the user to pick one of them and then some data inside of it 15049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and returning the resulting URI to the caller. This can be used, 15149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * for example, in an e-mail application to allow the user to pick some 15249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data to include as an attachment.</p> 15349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </li> 15449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 15549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 15649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>There are a variety of standard Intent action and category constants 15749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * defined in the Intent class, but applications can also define their own. 15849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * These strings use java style scoping, to ensure they are unique -- for 15949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * example, the standard {@link #ACTION_VIEW} is called 16049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * "android.intent.action.VIEW".</p> 16149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 162ca4128f292d30374103de848a5805171d9a5a186Adam Powell * <p>Put together, the set of actions, data types, categories, and extra data 1634b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * defines a language for the system allowing for the expression of phrases 164ca4128f292d30374103de848a5805171d9a5a186Adam Powell * such as "call john smith's cell". As applications are added to the system, 16549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * they can extend this language by adding new actions, types, and categories, or 16649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * they can modify the behavior of existing phrases by supplying their own 16749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activities that handle them.</p> 168f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * 169f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <a name="IntentResolution"></a> 170f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <h3>Intent Resolution</h3> 17149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 17249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>There are two primary forms of intents you will use. 17349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 17449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 17549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>Explicit Intents</b> have specified a component (via 17649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #setComponent} or {@link #setClass}), which provides the exact 17749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * class to be run. Often these will not include any other information, 17849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * simply being a way for an application to launch various internal 17949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activities it has as the user interacts with the application. 18049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 18149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>Implicit Intents</b> have not specified a component; 18249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * instead, they must include enough information for the system to 18349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * determine which of the available components is best to run for that 18449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * intent. 18549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 18649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 18749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>When using implicit intents, given such an arbitrary intent we need to 18849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * know what to do with it. This is handled by the process of <em>Intent 189c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * resolution</em>, which maps an Intent to an {@link android.app.Activity}, 190c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * {@link BroadcastReceiver}, or {@link android.app.Service} (or sometimes two or 19149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * more activities/receivers) that can handle it.</p> 19249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 19349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The intent resolution mechanism basically revolves around matching an 194ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * Intent against all of the <intent-filter> descriptions in the 195ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * installed application packages. (Plus, in the case of broadcasts, any {@link BroadcastReceiver} 196ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * objects explicitly registered with {@link Context#registerReceiver}.) More 197ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * details on this can be found in the documentation on the {@link 198ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * IntentFilter} class.</p> 199ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * 200469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * <p>There are three pieces of information in the Intent that are used for 201469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * resolution: the action, type, and category. Using this information, a query 20249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is done on the {@link PackageManager} for a component that can handle the 20349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * intent. The appropriate component is determined based on the intent 20449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * information supplied in the <code>AndroidManifest.xml</code> file as 20549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * follows:</p> 20694756719872ef2f4a60d59eb1e2169011312676bScott Kennedy * 20749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 20849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p>The <b>action</b>, if given, must be listed by the component as 20949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * one it handles.</p> 21094756719872ef2f4a60d59eb1e2169011312676bScott Kennedy * <li> <p>The <b>type</b> is retrieved from the Intent's data, if not 211282b41afb218f7b7becd0a1c420ddd21fc14c3dbChris Banes * already supplied in the Intent. Like the action, if a type is 21249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * included in the intent (either explicitly or implicitly in its 2131cc199c7b4fe79812cd660b387fa521c9b1993fcChris Banes * data), then this must be listed by the component as one it handles.</p> 214469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * <li> For data that is not a <code>content:</code> URI and where no explicit 215469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * type is included in the Intent, instead the <b>scheme</b> of the 21649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * intent data (such as <code>http:</code> or <code>mailto:</code>) is 21749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * considered. Again like the action, if we are matching a scheme it 21849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * must be listed by the component as one it can handle. 21949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p>The <b>categories</b>, if supplied, must <em>all</em> be listed 220aac6aa7699cefacf5cd3aaa17c97c2f574ba1259Chris Banes * by the activity as categories it handles. That is, if you include 22149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the categories {@link #CATEGORY_LAUNCHER} and 22249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #CATEGORY_ALTERNATIVE}, then you will only resolve to components 22349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * with an intent that lists <em>both</em> of those categories. 22449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activities will very often need to support the 22549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #CATEGORY_DEFAULT} so that they can be found by 22649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link Context#startActivity Context.startActivity()}.</p> 22749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 22849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 22949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>For example, consider the Note Pad sample application that 23049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * allows user to browse through a list of notes data and view details about 23149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * individual items. Text in italics indicate places were you would replace a 23249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * name with one specific to your own package.</p> 23349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 23449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <pre> <manifest xmlns:android="http://schemas.android.com/apk/res/android" 23549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * package="<i>com.android.notepad</i>"> 23649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <application android:icon="@drawable/app_notes" 23749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * android:label="@string/app_name"> 23849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 23949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <provider class=".NotePadProvider" 24049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * android:authorities="<i>com.google.provider.NotePad</i>" /> 24149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 24249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <activity class=".NotesList" android:label="@string/title_notes_list"> 24349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter> 24449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.MAIN" /> 24549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="android.intent.category.LAUNCHER" /> 24649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter> 24749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter> 24849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.VIEW" /> 24949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.EDIT" /> 25049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.PICK" /> 25149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="android.intent.category.DEFAULT" /> 25249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 25349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter> 25449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter> 25549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.GET_CONTENT" /> 25649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="android.intent.category.DEFAULT" /> 25749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 25849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter> 25949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </activity> 26049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 26149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <activity class=".NoteEditor" android:label="@string/title_note"> 26249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter android:label="@string/resolve_edit"> 26349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.VIEW" /> 26449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.EDIT" /> 26549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="android.intent.category.DEFAULT" /> 2663e2b5bd049c924bf6d29615973bc598a6d50e6cbAlan Viverette * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 26749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter> 26849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 26949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter> 27049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="android.intent.action.INSERT" /> 27149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="android.intent.category.DEFAULT" /> 27249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 27349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter> 27449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 27549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </activity> 27649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 27761c0bbe56a13fe55ce91a5b1d64e751164ecb894Chris Banes * <activity class=".TitleEditor" android:label="@string/title_edit_title" 27861c0bbe56a13fe55ce91a5b1d64e751164ecb894Chris Banes * android:theme="@android:style/Theme.Dialog"> 27961c0bbe56a13fe55ce91a5b1d64e751164ecb894Chris Banes * <intent-filter android:label="@string/resolve_title"> 280ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> 281ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <category android:name="android.intent.category.DEFAULT" /> 282ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <category android:name="android.intent.category.ALTERNATIVE" /> 283ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> 284ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 285ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * </intent-filter> 286ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * </activity> 287ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * 288ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * </application> 289d30166708029d4fb895edcaec3ad3fa6645d5311Chris Banes * </manifest></pre> 29064c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * 29164c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <p>The first activity, 29264c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <code>com.android.notepad.NotesList</code>, serves as our main 29364c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * entry into the app. It can do three things as described by its three intent 29464c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * templates: 29564c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <ol> 29664c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <li><pre> 29764c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <intent-filter> 29864c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <action android:name="{@link #ACTION_MAIN android.intent.action.MAIN}" /> 29964c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <category android:name="{@link #CATEGORY_LAUNCHER android.intent.category.LAUNCHER}" /> 30064c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * </intent-filter></pre> 30164c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <p>This provides a top-level entry into the NotePad application: the standard 30264c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * MAIN action is a main entry point (not requiring any other information in 30364c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * the Intent), and the LAUNCHER category says that this entry point should be 30464c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * listed in the application launcher.</p> 30564c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <li><pre> 30664c32ba7ea8a7c71835e33d7f208824bf1081a24Adam Powell * <intent-filter> 30749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> 308469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> 309469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * <action android:name="{@link #ACTION_PICK android.intent.action.PICK}" /> 310469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 31149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data mimeType:name="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 31249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter></pre> 31349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>This declares the things that the activity can do on a directory of 31449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * notes. The type being supported is given with the <type> tag, where 31549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <code>vnd.android.cursor.dir/vnd.google.note</code> is a URI from which 31649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a Cursor of zero or more items (<code>vnd.android.cursor.dir</code>) can 31749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * be retrieved which holds our note pad data (<code>vnd.google.note</code>). 31849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The activity allows the user to view or edit the directory of data (via 31949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the VIEW and EDIT actions), or to pick a particular note and return it 320f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * to the caller (via the PICK action). Note also the DEFAULT category 32149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * supplied here: this is <em>required</em> for the 32249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link Context#startActivity Context.startActivity} method to resolve your 32349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activity when its component name is not explicitly specified.</p> 32449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><pre> 32549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter> 32649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="{@link #ACTION_GET_CONTENT android.intent.action.GET_CONTENT}" /> 32749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 32849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 32949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter></pre> 33049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>This filter describes the ability return to the caller a note selected by 33149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the user without needing to know where it came from. The data type 33249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <code>vnd.android.cursor.item/vnd.google.note</code> is a URI from which 33349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a Cursor of exactly one (<code>vnd.android.cursor.item</code>) item can 33449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * be retrieved which contains our note pad data (<code>vnd.google.note</code>). 33549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The GET_CONTENT action is similar to the PICK action, where the activity 33649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * will return to its caller a piece of data selected by the user. Here, 33749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * however, the caller specifies the type of data they desire instead of 33849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the type of data the user will be picking from.</p> 33949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ol> 34049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 34149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Given these capabilities, the following intents will resolve to the 34249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * NotesList activity:</p> 34349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 344ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <ul> 34549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.app.action.MAIN }</b> matches all of the 34649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activities that can be used as top-level entry points into an 34749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * application.</p> 34849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.app.action.MAIN, 34949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * category=android.app.category.LAUNCHER }</b> is the actual intent 35049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * used by the Launcher to populate its top-level list.</p> 35149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.intent.action.VIEW 35249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data=content://com.google.provider.NotePad/notes }</b> 35349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * displays a list of all the notes under 35449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * "content://com.google.provider.NotePad/notes", which 35549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the user can browse through and see the details on.</p> 356f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * <li> <p><b>{ action=android.app.action.PICK 357469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * data=content://com.google.provider.NotePad/notes }</b> 35849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * provides a list of the notes under 35949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * "content://com.google.provider.NotePad/notes", from which 36049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the user can pick a note whose data URL is returned back to the caller.</p> 36149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.app.action.GET_CONTENT 36249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * type=vnd.android.cursor.item/vnd.google.note }</b> 36349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is similar to the pick action, but allows the caller to specify the 36449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * kind of data they want back so that the system can find the appropriate 36549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activity to pick something of that data type.</p> 36649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 36749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 36849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The second activity, 36949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <code>com.android.notepad.NoteEditor</code>, shows the user a single 37049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * note entry and allows them to edit it. It can do two things as described 37149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by its two intent templates: 37249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ol> 37349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><pre> 37449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter android:label="@string/resolve_edit"> 37549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> 37649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> 37749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 37849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 37949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter></pre> 38049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The first, primary, purpose of this activity is to let the user interact 38149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * with a single note, as decribed by the MIME type 38249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <code>vnd.android.cursor.item/vnd.google.note</code>. The activity can 38349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * either VIEW a note or allow the user to EDIT it. Again we support the 38449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * DEFAULT category to allow the activity to be launched without explicitly 38549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * specifying its component.</p> 38649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><pre> 38749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter> 38849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="{@link #ACTION_INSERT android.intent.action.INSERT}" /> 38949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 39049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 39149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter></pre> 39249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The secondary use of this activity is to insert a new note entry into 39349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * an existing directory of notes. This is used when the user creates a new 39449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * note: the INSERT action is executed on the directory of notes, causing 39549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * this activity to run and have the user create the new note data which 39649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * it then adds to the content provider.</p> 39749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ol> 39849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 39949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Given these capabilities, the following intents will resolve to the 40049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * NoteEditor activity:</p> 40149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 40249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 40349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.intent.action.VIEW 40449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> 40549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * shows the user the content of note <var>{ID}</var>.</p> 40649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.app.action.EDIT 40749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> 40849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * allows the user to edit the content of note <var>{ID}</var>.</p> 40949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=android.app.action.INSERT 41049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data=content://com.google.provider.NotePad/notes }</b> 41149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * creates a new, empty note in the notes list at 41249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * "content://com.google.provider.NotePad/notes" 41349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and allows the user to edit it. If they keep their changes, the URI 41449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of the newly created note is returned to the caller.</p> 41549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 41649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 41749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The last activity, 41849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <code>com.android.notepad.TitleEditor</code>, allows the user to 41949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * edit the title of a note. This could be implemented as a class that the 42049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * application directly invokes (by explicitly setting its component in 42149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the Intent), but here we show a way you can publish alternative 42249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * operations on existing data:</p> 42349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 42449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <pre> 42549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <intent-filter android:label="@string/resolve_title"> 42649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> 42749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 42849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="{@link #CATEGORY_ALTERNATIVE android.intent.category.ALTERNATIVE}" /> 42949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <category android:name="{@link #CATEGORY_SELECTED_ALTERNATIVE android.intent.category.SELECTED_ALTERNATIVE}" /> 43049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 43149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </intent-filter></pre> 43249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 43349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>In the single intent template here, we 43449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * have created our own private action called 43549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <code>com.android.notepad.action.EDIT_TITLE</code> which means to 43649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * edit the title of a note. It must be invoked on a specific note 43749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (data type <code>vnd.android.cursor.item/vnd.google.note</code>) like the previous 43849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * view and edit actions, but here displays and edits the title contained 43949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * in the note data. 44049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 44149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>In addition to supporting the default category as usual, our title editor 44249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * also supports two other standard categories: ALTERNATIVE and 44349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * SELECTED_ALTERNATIVE. Implementing 44449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * these categories allows others to find the special action it provides 44549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * without directly knowing about it, through the 44649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link android.content.pm.PackageManager#queryIntentActivityOptions} method, or 44749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * more often to build dynamic menu items with 44849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link android.view.Menu#addIntentOptions}. Note that in the intent 44949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * template here was also supply an explicit name for the template 45049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (via <code>android:label="@string/resolve_title"</code>) to better control 45149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * what the user sees when presented with this activity as an alternative 45249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * action to the data they are viewing. 45349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 45449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Given these capabilities, the following intent will resolve to the 45549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * TitleEditor activity:</p> 45649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 45749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 45849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> <p><b>{ action=com.android.notepad.action.EDIT_TITLE 45949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> 46049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * displays and allows the user to edit the title associated 46149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * with note <var>{ID}</var>.</p> 46249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 46349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 46449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <h3>Standard Activity Actions</h3> 46549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 46649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>These are the current standard actions that Intent defines for launching 46749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activities (usually through {@link Context#startActivity}. The most 46849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * important, and by far most frequently used, are {@link #ACTION_MAIN} and 46949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #ACTION_EDIT}. 47049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 47149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 47249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_MAIN} 47349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_VIEW} 47449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_ATTACH_DATA} 475f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <li> {@link #ACTION_EDIT} 476f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <li> {@link #ACTION_PICK} 47749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_CHOOSER} 478f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <li> {@link #ACTION_GET_CONTENT} 47949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_DIAL} 480f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <li> {@link #ACTION_CALL} 48149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_SEND} 48249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_SENDTO} 48349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_ANSWER} 48449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_INSERT} 48549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_DELETE} 48649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_RUN} 48749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_SYNC} 48849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_PICK_ACTIVITY} 48949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_SEARCH} 49049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_WEB_SEARCH} 49149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_FACTORY_TEST} 49249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 49349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 49449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <h3>Standard Broadcast Actions</h3> 49549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 49649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>These are the current standard actions that Intent defines for receiving 49749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * broadcasts (usually through {@link Context#registerReceiver} or a 49849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <receiver> tag in a manifest). 49949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 50049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 50149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_TIME_TICK} 50249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_TIME_CHANGED} 50349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_TIMEZONE_CHANGED} 50449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_BOOT_COMPLETED} 50549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_PACKAGE_ADDED} 506f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * <li> {@link #ACTION_PACKAGE_CHANGED} 50749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_PACKAGE_REMOVED} 50849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_PACKAGE_RESTARTED} 50949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} 51049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_UID_REMOVED} 51149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_BATTERY_CHANGED} 51249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_POWER_CONNECTED} 51349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_POWER_DISCONNECTED} 51449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #ACTION_SHUTDOWN} 51549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 51649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 51749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <h3>Standard Categories</h3> 51849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 51949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>These are the current standard categories that can be used to further 52049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * clarify an Intent via {@link #addCategory}. 52149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 52249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 52349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_DEFAULT} 52449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_BROWSABLE} 52549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_TAB} 52649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_ALTERNATIVE} 52749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_SELECTED_ALTERNATIVE} 52849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_LAUNCHER} 52949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_INFO} 53049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_HOME} 53149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_PREFERENCE} 53249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_TEST} 53349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_CAR_DOCK} 53449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #CATEGORY_DESK_DOCK} 53549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 53649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 53749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <h3>Standard Extra Data</h3> 53849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 53949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>These are the current standard fields that can be used as extra data via 54049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #putExtra}. 54149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 54249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 54349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_ALARM_COUNT} 54449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_BCC} 54549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_CC} 54649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME} 54749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DATA_REMOVED} 54849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DOCK_STATE} 54949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DOCK_STATE_CAR} 55049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DOCK_STATE_DESK} 55149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DOCK_STATE_UNDOCKED} 55249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DONT_KILL_APP} 55349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_EMAIL} 55449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_INITIAL_INTENTS} 55549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_INTENT} 55649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_KEY_EVENT} 55749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_PHONE_NUMBER} 55849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_REMOTE_INTENT_TOKEN} 55949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_REPLACING} 56049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_SHORTCUT_ICON} 56149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_SHORTCUT_ICON_RESOURCE} 56249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_SHORTCUT_INTENT} 56349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_STREAM} 56449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_SHORTCUT_NAME} 56549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_SUBJECT} 56649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_TEMPLATE} 56749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_TEXT} 56849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_TITLE} 56949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} 57049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 57149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 57249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <h3>Flags</h3> 57349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 57449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>These are the possible flags that can be used in the Intent via 57549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #setFlags} and {@link #addFlags}. See {@link #setFlags} for a list 57649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of all possible flags. 57749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 57849c78900da0d43140fb602431fb93212bd7f6c70Chris Banespublic class Intent implements Parcelable, Cloneable { 57949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // --------------------------------------------------------------------- 58049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // --------------------------------------------------------------------- 58149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // Standard intent activity actions (see action variable). 58249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 58349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 58449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Start as a main entry point, does not expect to 58549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * receive data. 58649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: nothing 58749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing 58849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 58949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 59049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MAIN = "android.intent.action.MAIN"; 591f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye 59249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 59349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Display the data to the user. This is the most common 59449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * action performed on data -- it is the generic action you can use on 59549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a piece of data to get the most reasonable thing to occur. For example, 59649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * when used on a contacts entry it will view the entry; when used on a 59749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * mailto: URI it will bring up a compose window filled with the information 59849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * supplied by the URI; when used with a tel: URI it will invoke the 59949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * dialer. 60049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI from which to retrieve data. 60149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 60249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 60349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 60449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_VIEW = "android.intent.action.VIEW"; 60549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 60649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 60749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A synonym for {@link #ACTION_VIEW}, the "standard" action that is 60849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * performed on a piece of data. 60949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 61049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DEFAULT = ACTION_VIEW; 61149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 61249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 61349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Used to indicate that some piece of data should be attached to some other 61449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * place. For example, image data could be attached to a contact. It is up 61549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * to the recipient to decide where the data should be attached; the intent 61649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * does not specify the ultimate destination. 617f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p>Input: {@link #getData} is URI of data to be attached. 618f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p>Output: nothing. 61949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 620f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 62149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; 622f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell 62349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 62449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Provide explicit editable access to the given data. 62549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI of data to be edited. 62649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 62749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 62849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 62949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_EDIT = "android.intent.action.EDIT"; 63049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 63149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 63249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Pick an existing item, or insert a new item, and then edit it. 63349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getType} is the desired MIME type of the item to create or edit. 63449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The extras can contain type specific data to pass through to the editing/creating 63549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * activity. 63649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: The URI of the item that was picked. This must be a content: 63749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * URI so that any receiver can access it. 63849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 63949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 64049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"; 64149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 64249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 64349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Pick an item from the data, returning what was selected. 64449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI containing a directory of data 64549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (vnd.android.cursor.dir/*) from which to pick an item. 646f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * <p>Output: The URI of the item that was picked. 64749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 64849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 64949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PICK = "android.intent.action.PICK"; 65049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 65149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 65249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Creates a shortcut. 65349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing.</p> 65449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: An Intent representing the shortcut. The intent must contain three 65549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), 65649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE 65749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (value: ShortcutIconResource).</p> 65849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 65949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #EXTRA_SHORTCUT_INTENT 66049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #EXTRA_SHORTCUT_NAME 66149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #EXTRA_SHORTCUT_ICON 66249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #EXTRA_SHORTCUT_ICON_RESOURCE 66349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see android.content.Intent.ShortcutIconResource 66449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 66549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 66649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"; 66749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 66849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 66949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The name of the extra used to define the Intent of a shortcut. 67049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 671f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * @see #ACTION_CREATE_SHORTCUT 672f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell */ 67349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"; 674f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell /** 67549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The name of the extra used to define the name of a shortcut. 676f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * 67749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #ACTION_CREATE_SHORTCUT 67849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 67949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"; 68049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 68149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The name of the extra used to define the icon, as a Bitmap, of a shortcut. 68249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 68349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #ACTION_CREATE_SHORTCUT 68449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 68549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"; 68649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 68749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut. 688f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * 68949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see #ACTION_CREATE_SHORTCUT 69049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see android.content.Intent.ShortcutIconResource 69149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 69249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_SHORTCUT_ICON_RESOURCE = 69349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.extra.shortcut.ICON_RESOURCE"; 69449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 69549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 69649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Represents a shortcut/live folder icon resource. 69749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 69849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see Intent#ACTION_CREATE_SHORTCUT 699f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * @see Intent#EXTRA_SHORTCUT_ICON_RESOURCE 70049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see android.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER 70149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see android.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON 70249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 70349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static class ShortcutIconResource implements Parcelable { 70449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 70549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The package name of the application containing the icon. 70649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 70749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public String packageName; 70849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 70949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 71049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The resource name of the icon, including package, name and type. 71170acb0c19be3831a2080e4f902324de16bfbf62eTor Norbye */ 71249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public String resourceName; 71349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 71449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 71549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Creates a new ShortcutIconResource for the specified context and resource 71649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * identifier. 71749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 71849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param context The context of the application. 71949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param resourceId The resource idenfitier for the icon. 72049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return A new ShortcutIconResource with the specified's context package name 72149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and icon resource idenfitier. 72249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 72370acb0c19be3831a2080e4f902324de16bfbf62eTor Norbye public static ShortcutIconResource fromContext(Context context, int resourceId) { 72449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes ShortcutIconResource icon = new ShortcutIconResource(); 72549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes icon.packageName = context.getPackageName(); 72649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes icon.resourceName = context.getResources().getResourceName(resourceId); 72749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return icon; 72849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 72949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 73049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 73149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Used to read a ShortcutIconResource from a Parcel. 73249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 73349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final Parcelable.Creator<ShortcutIconResource> CREATOR = 73449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes new Parcelable.Creator<ShortcutIconResource>() { 73549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 73649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public ShortcutIconResource createFromParcel(Parcel source) { 737ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein ShortcutIconResource icon = new ShortcutIconResource(); 73849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes icon.packageName = source.readString(); 73949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes icon.resourceName = source.readString(); 74049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return icon; 74149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 74249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 74349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public ShortcutIconResource[] newArray(int size) { 74449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return new ShortcutIconResource[size]; 74549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 74649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes }; 747ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein 748ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein /** 74949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * No special parcel contents. 750f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye */ 751ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein public int describeContents() { 75249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0; 75349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 75449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 75549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void writeToParcel(Parcel dest, int flags) { 75649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes dest.writeString(packageName); 75749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes dest.writeString(resourceName); 75849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 759ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein 760ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein @Override 76149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public String toString() { 762ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein return resourceName; 763ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein } 764ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein } 765ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein 766ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein /** 767ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * Activity Action: Display an activity chooser, allowing the user to pick 768ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * what they want to before proceeding. This can be used as an alternative 769ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * to the standard activity picker that is displayed by the system when 770c005695ca3e01efb3c3486f5cb6bf1e7fb21995cChris Banes * you try to start an activity with multiple possible matches, with these 771ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * differences in behavior: 772ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * <ul> 773ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * <li>You can specify the title that will appear in the activity chooser. 774ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * <li>The user does not have the option to make one of the matching 775ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * activities a preferred activity, and all possible activities will 776ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * always be shown even if one of them is currently marked as the 777ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * preferred activity. 778ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * </ul> 779ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * <p> 780ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * This action should be used when the user will naturally expect to 781ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * select an activity in order to proceed. An example if when not to use 782ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * it is when the user clicks on a "mailto:" link. They would naturally 783f694ca99453213b7ce3c2a46e237209fcb5841cdTor Norbye * expect to go directly to their mail app, so startActivity() should be 784469286122bcbbecbdd0bef74fb50f9d8920e77b9Chris Banes * called directly: it will 78549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * either launch the current preferred app, or put up a dialog allowing the 78649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * user to pick an app to use and optionally marking that as preferred. 78749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 78849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * In contrast, if the user is selecting a menu item to send a picture 78949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * they are viewing to someone else, there are many different things they 79049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * may want to do at this point: send it through e-mail, upload it to a 79149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * web service, etc. In this case the CHOOSER action should be used, to 79249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * always present to the user a list of the things they can do, with a 79349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * nice title given by the caller such as "Send this photo with:". 794a2c72b87007d10202c25e78e904938f770c6337dChris Banes * <p> 795a2c72b87007d10202c25e78e904938f770c6337dChris Banes * As a convenience, an Intent of this form can be created with the 79649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #createChooser} function. 797a2c72b87007d10202c25e78e904938f770c6337dChris Banes * <p>Input: No data should be specified. get*Extra must have 79849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a {@link #EXTRA_INTENT} field containing the Intent being executed, 799ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein * and can optionally have a {@link #EXTRA_TITLE} field containing the 80049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * title text to display in the chooser. 80149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: Depends on the protocol of {@link #EXTRA_INTENT}. 802f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell */ 803f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 80449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER"; 805f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell 80649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 807f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * Convenience function for creating a {@link #ACTION_CHOOSER} Intent. 80849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 80949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param target The Intent that the user will be selecting an activity 81049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * to perform. 81149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param title Optional title that will be displayed in the chooser. 81249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return Return a new Intent object that you can hand to 81349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link Context#startActivity(Intent) Context.startActivity()} and 81449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * related methods. 81549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 81649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static Intent createChooser(Intent target, CharSequence title) { 81749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes Intent intent = new Intent(ACTION_CHOOSER); 81849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes intent.putExtra(EXTRA_INTENT, target); 819ebec8cacc3ebeea96b6c49890ee145d7e60cd7cdAndrew Sapperstein if (title != null) { 82049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes intent.putExtra(EXTRA_TITLE, title); 82149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 82249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return intent; 82349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 82449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 82549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Allow the user to select a particular kind of data and 82649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * return it. This is different than {@link #ACTION_PICK} in that here we 82749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * just say what kind of data is desired, not a URI of existing data from 82849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * which the user can pick. A ACTION_GET_CONTENT could allow the user to 82949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * create the data as it runs (for example taking a picture or recording a 83049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * sound), let them browser over the web and download the desired data, 83149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * etc. 83249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 83349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * There are two main ways to use this action: if you want an specific kind 83449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of data, such as a person contact, you set the MIME type to the kind of 83549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data you want and launch it with {@link Context#startActivity(Intent)}. 83649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The system will then launch the best application to select that kind 83749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of data for you. 83849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 8397325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * You may also be interested in any of a set of types of content the user 840c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * can pick. For example, an e-mail application that wants to allow the 8417325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * user to add an attachment to an e-mail message can use this action to 8427325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * bring up a list of all of the types of content the user can attach. 843c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * <p> 8447325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * In this case, you should wrap the GET_CONTENT intent with a chooser 845c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * (through {@link #createChooser}), which will give the proper interface 8467325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * for the user to pick how to send your data and allow you to specify 8477325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * a prompt indicating what they are doing. You will usually specify a 8487325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * broad MIME type (such as image/* or {@literal *}/*), resulting in a 849c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * broad range of content types the user can select from. 850c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * <p> 851c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * When using such a broad GET_CONTENT action, it is often desireable to 8527325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * only pick from data that can be represented as a stream. This is 853c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent. 8547325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * <p> 855c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * Input: {@link #getType} is the desired MIME type to retrieve. Note 8567325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * that no URI is supplied in the intent, as there are no constraints on 8577325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * where the returned data originally comes from. You may also include the 8587325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * {@link #CATEGORY_OPENABLE} if you can only accept data that can be 859c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * opened as a stream. 860c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * <p> 861c88bcc13910d9d1a0ddd077e7cb96f3d95bde76cChris Banes * Output: The URI of the item that was picked. This must be a content: 8627325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * URI so that any receiver can access it. 86349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 8647325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 86549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"; 8667325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes /** 8677325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * Activity Action: Dial a number as specified by the data. This shows a 86849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * UI with the number being dialed, allowing the user to explicitly 8697325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * initiate the call. 87049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: If nothing, an empty dialer is started; else {@link #getData} 87149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is URI of a phone number to be dialed or a tel: URI of an explicit phone 87249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * number. 87349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 87449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 87549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 87649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DIAL = "android.intent.action.DIAL"; 87749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 87849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Perform a call to someone specified by the data. 87949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: If nothing, an empty dialer is started; else {@link #getData} 88049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is URI of a phone number to be dialed or a tel: URI of an explicit phone 88149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * number. 88249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 88349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 88449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Note: there will be restrictions on which applications can initiate a 88549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * call; most applications should use the {@link #ACTION_DIAL}. 88649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Note: this Intent <strong>cannot</strong> be used to call emergency 88749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * numbers. Applications can <strong>dial</strong> emergency numbers using 88849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #ACTION_DIAL}, however. 88949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 890c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 89149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CALL = "android.intent.action.CALL"; 89249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 89349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Perform a call to an emergency number specified by the 894f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * data. 89549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI of a phone number to be dialed or a 89649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * tel: URI of an explicit phone number. 89749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 89849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 89949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 90049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY"; 90149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 90249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity action: Perform a call to any number (emergency or not) 90349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * specified by the data. 90449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI of a phone number to be dialed or a 90549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * tel: URI of an explicit phone number. 90649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 90749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 90849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 90949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED"; 9107325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes /** 91149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Send a message to someone specified by the data. 91249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI describing the target. 91349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 91449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 91549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 91649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SENDTO = "android.intent.action.SENDTO"; 91749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 91849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Deliver some data to someone else. Who the data is 91949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * being delivered to is not specified; it is up to the receiver of this 92049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * action to ask the user where the data should be sent. 92149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 92249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * When launching a SEND intent, you should usually wrap it in a chooser 92349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (through {@link #createChooser}), which will give the proper interface 92449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * for the user to pick how to send your data and allow you to specify 92549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a prompt indicating what they are doing. 92649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 92749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Input: {@link #getType} is the MIME type of the data being sent. 92849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * get*Extra can have either a {@link #EXTRA_TEXT} 92949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * or {@link #EXTRA_STREAM} field, containing the data to be sent. If 93049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it 93149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * should be the MIME type of the data in EXTRA_STREAM. Use {@literal *}/* 93249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * if the MIME type is unknown (this will only allow senders that can 93349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * handle generic data streams). 93449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 93549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Optional standard extras, which may be interpreted by some recipients as 93649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, 93749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. 93849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 93949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Output: nothing. 94049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 94149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 94249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SEND = "android.intent.action.SEND"; 94349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 94449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Deliver multiple data to someone else. 94549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 94649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Like ACTION_SEND, except the data is multiple. 94749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 94849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Input: {@link #getType} is the MIME type of the data being sent. 94949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * get*ArrayListExtra can have either a {@link #EXTRA_TEXT} or {@link 95049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * #EXTRA_STREAM} field, containing the data to be sent. 95149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 95249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Multiple types are supported, and receivers should handle mixed types 95349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * whenever possible. The right way for the receiver to check them is to 95449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * use the content resolver on each URI. The intent sender should try to 95549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * put the most concrete mime type in the intent type, but it can fall 95649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * back to {@literal <type>/*} or {@literal *}/* as needed. 95749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 95849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * e.g. if you are sending image/jpg and image/jpg, the intent's type can 95949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * be image/jpg, but if you are sending image/jpg and image/png, then the 96049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * intent's type should be image/*. 96149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 96249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Optional standard extras, which may be interpreted by some recipients as 96349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, 96449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. 96549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 96649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Output: nothing. 96749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 96849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 96949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE"; 97049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 97149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Handle an incoming phone call. 97249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: nothing. 97349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 97449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 97549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 97649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_ANSWER = "android.intent.action.ANSWER"; 97749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 97849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Insert an empty item into the given container. 97949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) 98049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * in which to place the data. 98149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: URI of the new data that was created. 98249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 98349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 98449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_INSERT = "android.intent.action.INSERT"; 98549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 98649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Delete the given data from its container. 98749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is URI of data to be deleted. 98849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 98949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 99049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 99149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DELETE = "android.intent.action.DELETE"; 99249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 99349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Run the data, whatever that means. 99449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: ? (Note: this is currently specific to the test harness.) 99549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 99649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 99749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 99849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_RUN = "android.intent.action.RUN"; 99949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 100049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Perform a data synchronization. 100149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: ? 100249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: ? 100349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 100449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 100549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SYNC = "android.intent.action.SYNC"; 100649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 100749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Pick an activity given an intent, returning the class 100849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * selected. 100949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: get*Extra field {@link #EXTRA_INTENT} is an Intent 101049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * used with {@link PackageManager#queryIntentActivities} to determine the 101149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * set of activities from which to pick. 101249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: Class name of the activity that was selected. 101349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 101449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 101549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; 101649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 101749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Perform a search. 101849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} 101949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is the text to search for. If empty, simply 102049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * enter your search results Activity with the search UI activated. 102149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 102249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 102349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 102449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SEARCH = "android.intent.action.SEARCH"; 102549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 102649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Start the platform-defined tutorial 102749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} 102849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is the text to search for. If empty, simply 102949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * enter your search results Activity with the search UI activated. 103049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 103149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 103249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 103349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL"; 103449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 103549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Perform a web search. 103649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 103749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Input: {@link android.app.SearchManager#QUERY 103849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * getStringExtra(SearchManager.QUERY)} is the text to search for. If it is 103949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a url starts with http or https, the site will be opened. If it is plain 104049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * text, Google search will be applied. 104149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p> 104249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Output: nothing. 104349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 10447325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 104549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; 104649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 104749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: List all available applications 104849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing. 104949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: nothing. 105049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 105149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 105249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS"; 105349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 10547325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * Activity Action: Show settings for choosing wallpaper 105549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing. 105649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: Nothing. 10573e2b5bd049c924bf6d29615973bc598a6d50e6cbAlan Viverette */ 105849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 105949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER"; 106049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 106149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 106249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Show activity for reporting a bug. 106349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing. 106449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: Nothing. 106549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 106649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 106749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"; 106849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 106949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 107049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Main entry point for factory tests. Only used when 1071f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * the device is booting in factory test node. The implementing package 1072b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * must be installed in the system image. 1073b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * <p>Input: nothing 1074b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * <p>Output: nothing 1075b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes */ 1076b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST"; 1077b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes 1078b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes /** 1079b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * Activity Action: The user pressed the "call" button to go to the dialer 1080b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * or other appropriate UI for placing a call. 108149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing. 1082f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p>Output: Nothing. 1083f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell */ 1084f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1085f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"; 1086f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell 1087f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell /** 1088f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * Activity Action: Start Voice Command. 108949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing. 109049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Output: Nothing. 109149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 109249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 109349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; 1094ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes 1095ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes /** 1096ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * Activity Action: Start action associated with long pressing on the 1097ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * search key. 1098ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <p>Input: Nothing. 1099ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <p>Output: Nothing. 110049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 110149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 110249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS"; 110349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 110449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 110549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: The user pressed the "Report" button in the crash/ANR dialog. 110649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This intent is delivered to the package which installed the application, usually 1107ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * the Market. 1108ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <p>Input: No data is specified. The bug report is passed in using 1109ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * an {@link #EXTRA_BUG_REPORT} field. 1110ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <p>Output: Nothing. 1111ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * @hide 1112ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes */ 1113ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1114ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; 1115ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes 1116ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes /** 1117ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * Activity Action: Show power usage information to the user. 1118ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <p>Input: Nothing. 1119ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * <p>Output: Nothing. 1120ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes */ 1121ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1122ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; 1123ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes 1124ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes /** 1125ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * Activity Action: Setup wizard to launch after a platform update. This 1126ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * activity should have a string meta-data field associated with it, 1127ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * {@link #METADATA_SETUP_VERSION}, which defines the current version of 1128ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * the platform for setup. The activity will be launched only if 1129ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * {@link android.provider.Settings.Secure#LAST_SETUP_SHOWN} is not the 113049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * same value. 113149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: Nothing. 1132ca4128f292d30374103de848a5805171d9a5a186Adam Powell * <p>Output: Nothing. 1133ca4128f292d30374103de848a5805171d9a5a186Adam Powell * @hide 1134ca4128f292d30374103de848a5805171d9a5a186Adam Powell */ 1135ca4128f292d30374103de848a5805171d9a5a186Adam Powell @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1136ca4128f292d30374103de848a5805171d9a5a186Adam Powell public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP"; 1137ca4128f292d30374103de848a5805171d9a5a186Adam Powell 1138ca4128f292d30374103de848a5805171d9a5a186Adam Powell /** 1139ca4128f292d30374103de848a5805171d9a5a186Adam Powell * A string associated with a {@link #ACTION_UPGRADE_SETUP} activity 1140ca4128f292d30374103de848a5805171d9a5a186Adam Powell * describing the last run version of the platform that was setup. 1141ca4128f292d30374103de848a5805171d9a5a186Adam Powell * @hide 1142ca4128f292d30374103de848a5805171d9a5a186Adam Powell */ 1143ca4128f292d30374103de848a5805171d9a5a186Adam Powell public static final String METADATA_SETUP_VERSION = "android.SETUP_VERSION"; 1144ca4128f292d30374103de848a5805171d9a5a186Adam Powell 1145ca4128f292d30374103de848a5805171d9a5a186Adam Powell // --------------------------------------------------------------------- 1146ca4128f292d30374103de848a5805171d9a5a186Adam Powell // --------------------------------------------------------------------- 1147ca4128f292d30374103de848a5805171d9a5a186Adam Powell // Standard intent broadcast actions (see action variable). 1148ca4128f292d30374103de848a5805171d9a5a186Adam Powell 1149ca4128f292d30374103de848a5805171d9a5a186Adam Powell /** 1150ca4128f292d30374103de848a5805171d9a5a186Adam Powell * Broadcast Action: Sent after the screen turns off. 1151ca4128f292d30374103de848a5805171d9a5a186Adam Powell * 1152ca4128f292d30374103de848a5805171d9a5a186Adam Powell * <p class="note">This is a protected intent that can only be sent 1153ca4128f292d30374103de848a5805171d9a5a186Adam Powell * by the system. 1154ca4128f292d30374103de848a5805171d9a5a186Adam Powell */ 1155ca4128f292d30374103de848a5805171d9a5a186Adam Powell @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1156ca4128f292d30374103de848a5805171d9a5a186Adam Powell public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"; 1157ca4128f292d30374103de848a5805171d9a5a186Adam Powell /** 11584b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * Broadcast Action: Sent after the screen turns on. 11594b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * 11604b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * <p class="note">This is a protected intent that can only be sent 11614b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * by the system. 11624b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette */ 11634b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 11644b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON"; 11654b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette 11664b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette /** 11674b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * Broadcast Action: Sent when the user is present after device wakes up (e.g when the 11684b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * keyguard is gone). 11694b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * 11704b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * <p class="note">This is a protected intent that can only be sent 11714b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * by the system. 11724b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette */ 11734b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 11744b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT"; 11754b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette 11764b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette /** 11774b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * Broadcast Action: The current time has changed. Sent every 11784b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * minute. You can <em>not</em> receive this through components declared 11794b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * in manifests, only by exlicitly registering for it with 11804b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) 11814b1190de13d6408e24cbda5f77e6148f54206fd0Alan Viverette * Context.registerReceiver()}. 118249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 118349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 118449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 118549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 118649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 118749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK"; 118849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 118949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The time was set. 119049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 119149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 119249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET"; 119349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 119449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The date has changed. 119549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 119649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 119749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED"; 119849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 119949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The timezone has changed. The intent will have the following extra values:</p> 120049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 120149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>time-zone</em> - The java.util.TimeZone.getID() value identifying the new time zone.</li> 120249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 120349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 120449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 120549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 120649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 120749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 120849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; 120949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 121049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Alarm Changed Action: This is broadcast when the AlarmClock 121149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * application's alarm is set or unset. It is used by the 121249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * AlarmClock application and the StatusBar service. 121349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 121449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 121549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 121649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED"; 121749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 121849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Sync State Changed Action: This is broadcast when the sync starts or stops or when one has 121949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * been failing for a long time. It is used by the SyncManager and the StatusBar service. 122049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 122149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 122249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 122349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SYNC_STATE_CHANGED 122449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes = "android.intent.action.SYNC_STATE_CHANGED"; 122549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 122649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: This is broadcast once, after the system has finished 122749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * booting. It can be used to perform application-specific initialization, 122849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * such as installing alarms. You must hold the 122949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission 123049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * in order to receive this broadcast. 123149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 123249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 123349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 123449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 123549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 123649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED"; 123749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 123849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: This is broadcast when a user action should request a 123949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * temporary system dialog to dismiss. Some examples of temporary system 124049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * dialogs are the notification window-shade and the recent tasks dialog. 124149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 124249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS"; 124349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 124449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Trigger the download and eventual installation 124549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of a package. 124649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Input: {@link #getData} is the URI of the package file to download. 124749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 124849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 124949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 125049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 125149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 125249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; 125349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 125449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: A new application package has been installed on the 125549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * device. The data contains the name of the package. Note that the 125649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * newly installed package does <em>not</em> receive this broadcast. 125749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>My include the following extras: 125849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 125949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. 126049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_REPLACING} is set to true if this is following 126149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * an {@link #ACTION_PACKAGE_REMOVED} broadcast for the same package. 126249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 126349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 126449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 126549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 126649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 126749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 126849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"; 126949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 127049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: A new version of an application package has been 127149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * installed, replacing an existing version that was previously installed. 127249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The data contains the name of the package. 127349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>My include the following extras: 127449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 127549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. 127649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 127749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 127849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 127949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 128049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 128149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 128249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; 128349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 128449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: An existing application package has been removed from 128549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the device. The data contains the name of the package. The package 128649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * that is being installed does <em>not</em> receive this Intent. 128749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 128849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} containing the integer uid previously assigned 128949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * to the package. 129049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DATA_REMOVED} is set to true if the entire 129149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * application -- data and code -- is being removed. 129249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_REPLACING} is set to true if this will be followed 129349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by an {@link #ACTION_PACKAGE_ADDED} broadcast for the same package. 129449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 129549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 129649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 129749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 129849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 129949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 130049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; 130149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 130249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: An existing application package has been changed (e.g. 130349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a component has been enabled or disabled). The data contains the name of 130449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the package. 130549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 130649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 130749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST} containing the class name 130849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * of the changed components. 130949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_DONT_KILL_APP} containing boolean field to override the 131049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * default action of restarting the application. 131149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 131249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 131349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 131449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 131549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 131649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 131749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED"; 131849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 131949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 132049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Ask system services if there is any reason to 132149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * restart the given package. The data contains the name of the 132249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * package. 132349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 1324a2c72b87007d10202c25e78e904938f770c6337dChris Banes * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 1325a2c72b87007d10202c25e78e904938f770c6337dChris Banes * <li> {@link #EXTRA_PACKAGES} String array of all packages to check. 1326a2c72b87007d10202c25e78e904938f770c6337dChris Banes * </ul> 1327a2c72b87007d10202c25e78e904938f770c6337dChris Banes * 1328a2c72b87007d10202c25e78e904938f770c6337dChris Banes * <p class="note">This is a protected intent that can only be sent 1329a2c72b87007d10202c25e78e904938f770c6337dChris Banes * by the system. 1330a2c72b87007d10202c25e78e904938f770c6337dChris Banes */ 1331a2c72b87007d10202c25e78e904938f770c6337dChris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1332a2c72b87007d10202c25e78e904938f770c6337dChris Banes public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART"; 1333a2c72b87007d10202c25e78e904938f770c6337dChris Banes /** 1334a2c72b87007d10202c25e78e904938f770c6337dChris Banes * Broadcast Action: The user has restarted a package, and all of its 1335a2c72b87007d10202c25e78e904938f770c6337dChris Banes * processes have been killed. All runtime state 1336a2c72b87007d10202c25e78e904938f770c6337dChris Banes * associated with it (processes, alarms, notifications, etc) should 1337a2c72b87007d10202c25e78e904938f770c6337dChris Banes * be removed. Note that the restarted package does <em>not</em> 1338a2c72b87007d10202c25e78e904938f770c6337dChris Banes * receive this broadcast. 1339a2c72b87007d10202c25e78e904938f770c6337dChris Banes * The data contains the name of the package. 134049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 134149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 134249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 134349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 134449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 134549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 134649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 134749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 134849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; 134949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 135049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The user has cleared the data of a package. This should 135149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * be preceded by {@link #ACTION_PACKAGE_RESTARTED}, after which all of 135249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * its persistent data is erased and this broadcast sent. 135349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Note that the cleared package does <em>not</em> 135449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * receive this broadcast. The data contains the name of the package. 135549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 135649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 135749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 135849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 135949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 136049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 136149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 136249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 136349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED"; 136449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 136549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: A user ID has been removed from the system. The user 136649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * ID number is stored in the extra data under {@link #EXTRA_UID}. 136749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 136849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 136949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 137049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 137149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 137249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; 137349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 137449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 137549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Resources for a set of packages (which were 137649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * previously unavailable) are currently 137749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * available since the media on which they exist is available. 137849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a 137949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * list of packages whose availability changed. 138049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a 138149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * list of uids of packages whose availability changed. 138249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Note that the 138349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * packages in this list do <em>not</em> receive this broadcast. 138449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The specified set of packages are now available on the system. 138549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Includes the following extras: 138649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 138749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages 138849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * whose resources(were previously unavailable) are currently available. 138949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #EXTRA_CHANGED_UID_LIST} is the set of uids of the 139049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * packages whose resources(were previously unavailable) 139149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * are currently available. 139249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 139349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 139449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 139549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 139649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 1397b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes */ 1398a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1399b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = 140049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"; 140149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 1402b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes /** 1403b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * Broadcast Action: Resources for a set of packages are currently 140449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * unavailable since the media on which they exist is unavailable. 1405b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a 1406b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * list of packages whose availability changed. 140749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a 140849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * list of uids of packages whose availability changed. 140949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The specified set of packages can no longer be 141049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * launched and are practically unavailable on the system. 141149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Inclues the following extras: 1412b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * <ul> 1413b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages 141449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * whose resources are no longer available. 1415b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * {@link #EXTRA_CHANGED_UID_LIST} is the set of packages 1416b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * whose resources are no longer available. 141749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 141849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 141949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 142049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 142149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 1422b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes */ 1423b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 142449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = 1425b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABILE"; 1426b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes 142749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 142849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The current system wallpaper has changed. See 142949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link android.app.WallpaperManager} for retrieving the new wallpaper. 143049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 143149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 143249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"; 143349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 143449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The current device {@link android.content.res.Configuration} 143549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (orientation, locale, etc) has changed. When such a change happens, the 143649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * UIs (view hierarchy) will need to be rebuilt based on this new 1437b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * information; for the most part, applications don't need to worry about 1438b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * this, because the system will take care of stopping and restarting the 143949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * application to make sure it sees the new changes. Some system code that 1440b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * can not be restarted will need to watch for this action and handle it 1441b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * appropriately. 144249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 144349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note"> 144449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * You can <em>not</em> receive this through components declared 144549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * in manifests, only by explicitly registering for it with 144649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) 1447b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * Context.registerReceiver()}. 1448b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * 144949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 1450b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * by the system. 1451b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * 145249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @see android.content.res.Configuration 145349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 145449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 145549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED"; 145649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 145749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The current device's locale has changed. 145849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 145949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 146049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 146149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 146249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 146349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"; 146449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 146549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: This is a <em>sticky broadcast</em> containing the 146649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * charging state, level, and other information about the battery. 146749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * See {@link android.os.BatteryManager} for documentation on the 146849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * contents of the Intent. 146949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 147049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note"> 147149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * You can <em>not</em> receive this through components declared 147249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * in manifests, only by explicitly registering for it with 1473ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) 1474ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * Context.registerReceiver()}. See {@link #ACTION_BATTERY_LOW}, 147549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #ACTION_BATTERY_OKAY}, {@link #ACTION_POWER_CONNECTED}, 147649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and {@link #ACTION_POWER_DISCONNECTED} for distinct battery-related 147749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * broadcasts that are sent and can be received through manifest 147849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * receivers. 147949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 148049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 148149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 148249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 148349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 148449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED"; 148549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 148649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Indicates low battery condition on the device. 148749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This broadcast corresponds to the "Low battery warning" system dialog. 148849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 148949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 149049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 149149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 149249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 149349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; 149449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 149549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Indicates the battery is now okay after being low. 149649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This will be sent after {@link #ACTION_BATTERY_LOW} once the battery has 149749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * gone back up to an okay state. 149849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 149949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 150049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 150149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 1502ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 150349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY"; 150449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 150549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External power has been connected to the device. 150649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This is intended for applications that wish to register specifically to this notification. 150749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to 150849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * stay active to receive this notification. This action can be used to implement actions 150949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * that wait until power is available to trigger. 151049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 151149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 151249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 151349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 151449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 151549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; 151649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 151749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External power has been removed from the device. 151849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This is intended for applications that wish to register specifically to this notification. 151949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to 152049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * stay active to receive this notification. This action can be used to implement actions 152149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * that wait until power is available to trigger. 152249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 152349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 152449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 1525ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes */ 1526ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1527ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes public static final String ACTION_POWER_DISCONNECTED = 152849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.ACTION_POWER_DISCONNECTED"; 1529ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes /** 153049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Device is shutting down. 153149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This is broadcast when the device is being shut down (completely turned 153249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * off, not sleeping). Once the broadcast is complete, the final shutdown 153349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * will proceed and all unsaved data lost. Apps will not normally need 153449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * to handle this, since the foreground activity will be paused as well. 153549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 153649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 153749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 153849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 153949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 154049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN"; 154149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 154249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activity Action: Start this activity to request system shutdown. 154349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The optional boolean extra field {@link #EXTRA_KEY_CONFIRM} can be set to true 154449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * to request confirmation from the user before shutting down. 154549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 154649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 154749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 154849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 154949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@hide} 155049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 155149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_REQUEST_SHUTDOWN = "android.intent.action.ACTION_REQUEST_SHUTDOWN"; 1552ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes /** 1553ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * Broadcast Action: A sticky broadcast that indicates low memory 1554ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * condition on the device 155549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 155649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 155749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 155849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 155949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 156049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW"; 156149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 156249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Indicates low memory condition on the device no longer exists 156349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 1564b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * <p class="note">This is a protected intent that can only be sent 1565b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * by the system. 156649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 156749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 156849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; 156949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 157049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Indicates low memory condition notification acknowledged by user 1571b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * and package management should be started. 1572b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * This is triggered by the user from the ACTION_DEVICE_STORAGE_LOW 157349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * notification. 157449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 157549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 157649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE"; 157749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 157849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The device has entered USB Mass Storage mode. 157949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This is used mainly for the USB Settings panel. 158049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified 158149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * when the SD card file system is mounted or unmounted 158249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 158349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 158449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"; 158549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 158649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 158749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The device has exited USB Mass Storage mode. 158849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This is used mainly for the USB Settings panel. 158949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified 159049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * when the SD card file system is mounted or unmounted 1591b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes */ 1592b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 159349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"; 1594b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes 159549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 159649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media has been removed. 159749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the removed media is contained in the Intent.mData field. 159849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 159949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 160049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED"; 160149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 160249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 160349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media is present, but not mounted at its mount point. 160449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the removed media is contained in the Intent.mData field. 160549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 160649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 160749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED"; 160849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 160949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 161049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media is present, and being disk-checked 161149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the checking media is contained in the Intent.mData field. 161249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 161349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 161449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING"; 161549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 161649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 1617b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * Broadcast Action: External media is present, but is using an incompatible fs (or is blank) 1618b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes * The path to the mount point for the checking media is contained in the Intent.mData field. 161949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 162049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 162149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS"; 162249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 1623b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes /** 162449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media is present and mounted at its mount point. 162549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the removed media is contained in the Intent.mData field. 162649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The Intent contains an extra with name "read-only" and Boolean value to indicate if the 162749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * media was mounted read only. 162849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 162949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1630b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED"; 1631b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes 163249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 163349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media is unmounted because it is being shared via USB mass storage. 163449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the removed media is contained in the Intent.mData field. 163549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 1636b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 163749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED"; 163849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 163949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 164049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media was removed from SD card slot, but mount point was not unmounted. 164149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the removed media is contained in the Intent.mData field. 164249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 1643b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 164449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL"; 1645b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes 1646b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes /** 164749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: External media is present but cannot be mounted. 164849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the removed media is contained in the Intent.mData field. 1649b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes */ 165049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 165149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE"; 1652b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes 1653b7340d23e715fedb2af8d500102ab57b43fed38fChris Banes /** 165449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: User has expressed the desire to remove the external storage media. 165549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Applications should close all files they have open within the mount point when they receive this intent. 165649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the mount point for the media to be ejected is contained in the Intent.mData field. 165749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 165849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 165949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT"; 166049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 166149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 166249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The media scanner has started scanning a directory. 166349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the directory being scanned is contained in the Intent.mData field. 166449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 166549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 166649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED"; 166749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 166849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 166949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The media scanner has finished scanning a directory. 167049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the scanned directory is contained in the Intent.mData field. 167149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 167249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 167349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED"; 167449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 167549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 167649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Request the media scanner to scan a file and add it to the media database. 167749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The path to the file is contained in the Intent.mData field. 167849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 167949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 168049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE"; 168149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 168249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 168349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The "Media Button" was pressed. Includes a single 168449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that 168549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * caused the broadcast. 168649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 168749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 168849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON"; 168949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 169049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 169149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: The "Camera Button" was pressed. Includes a single 169249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that 169349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * caused the broadcast. 169449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 169549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 169649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON"; 169749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 169849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // *** NOTE: @todo(*) The following really should go into a more domain-specific 169949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // location; they are not general-purpose actions. 170049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 170149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 170249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: An GTalk connection has been established. 170349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 170449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 170549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_GTALK_SERVICE_CONNECTED = 170649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.GTALK_CONNECTED"; 170749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 170849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 170949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: An GTalk connection has been disconnected. 171049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 171149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 171249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_GTALK_SERVICE_DISCONNECTED = 171349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.GTALK_DISCONNECTED"; 171449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 171549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 171649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: An input method has been changed. 171749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 171849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 171949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_INPUT_METHOD_CHANGED = 172049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.INPUT_METHOD_CHANGED"; 172149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 172249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 172349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or 172449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * more radios have been turned off or on. The intent will have the following extra value:</p> 172549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 172649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>state</em> - A boolean value indicating whether Airplane Mode is on. If true, 172749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * then cell radio and possibly other radios such as bluetooth or WiFi may have also been 172849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * turned off</li> 172949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 173049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 173149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 173249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 173349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 173449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 173549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE"; 173649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 173749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 173849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Some content providers have parts of their namespace 173949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * where they publish new events or items that the user may be especially 174049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * interested in. For these things, they may broadcast this action when the 174149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * set of interesting items change. 174249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 174349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * For example, GmailProvider sends this notification when the set of unread 174449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * mail in the inbox changes. 174549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 174649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The data of the intent identifies which part of which provider 174749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * changed. When queried through the content resolver, the data URI will 174849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * return the data set in question. 174949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 175049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The intent will have the following extra values: 175149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 175249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>count</em> - The number of items in the data set. This is the 175349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * same as the number of items in the cursor returned by querying the 175449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data URI. </li> 175549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 175649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 175749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This intent will be sent at boot (if the count is non-zero) and when the 175849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * data set changes. It is possible for the data set to change without the 175949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * count changing (for example, if a new unread message arrives in the same 176049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * sync operation in which a message is archived). The phone should still 176149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * ring/vibrate/etc as normal in this case. 176249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 176349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 176449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PROVIDER_CHANGED = 176549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.PROVIDER_CHANGED"; 176649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 176749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 176849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Wired Headset plugged in or unplugged. 176949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 177049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The intent will have the following extra values: 177149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 177249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 177349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>name</em> - Headset type, human readable string </li> 177449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>microphone</em> - 1 if headset has a microphone, 0 otherwise </li> 177549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 177649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 177749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 177849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 177949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_HEADSET_PLUG = 178049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.HEADSET_PLUG"; 178149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 178249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 178349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: An outgoing call is about to be placed. 178449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 178549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The Intent will have the following extra value: 178649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <ul> 1787a2c72b87007d10202c25e78e904938f770c6337dChris Banes * <li><em>{@link android.content.Intent#EXTRA_PHONE_NUMBER}</em> - 178849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the phone number originally intended to be dialed.</li> 178949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 179049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Once the broadcast is finished, the resultData is used as the actual 179149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * number to call. If <code>null</code>, no call will be placed.</p> 1792f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p>It is perfectly acceptable for multiple receivers to process the 179349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * outgoing call in turn: for example, a parental control application 1794f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * might verify that the user is authorized to place the call at that 1795f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * time, then a number-rewriting application might add an area code if 179649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * one was not specified.</p> 179749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>For consistency, any receiver whose purpose is to prohibit phone 179849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * calls should have a priority of 0, to ensure it will see the final 1799f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * phone number to be dialed. 1800f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * Any receiver whose purpose is to rewrite phone numbers to be called 180149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * should have a positive priority. 180249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Negative priorities are reserved for the system for this broadcast; 180349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * using them may cause problems.</p> 180449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Any BroadcastReceiver receiving this Intent <em>must not</em> 1805f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * abort the broadcast.</p> 1806f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p>Emergency calls cannot be intercepted using this mechanism, and 1807f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * other calls cannot be modified to call emergency numbers using this 1808f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * mechanism. 1809f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p>You must hold the 1810ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * {@link android.Manifest.permission#PROCESS_OUTGOING_CALLS} 1811f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * permission to receive this Intent.</p> 1812f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * 1813f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * <p class="note">This is a protected intent that can only be sent 1814f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell * by the system. 1815f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell */ 1816ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1817ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes public static final String ACTION_NEW_OUTGOING_CALL = 181849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.NEW_OUTGOING_CALL"; 181949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 182049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 182149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: Have the device reboot. This is only for use by 182249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * system code. 182349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 182449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p class="note">This is a protected intent that can only be sent 182549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * by the system. 182649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 182749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 182849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_REBOOT = 1829c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes "android.intent.action.REBOOT"; 1830c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes 1831c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes /** 1832c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * Broadcast Action: A sticky broadcast indicating the phone was docked 1833c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * or undocked. 1834c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * 1835c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * <p>The intent will have the following extra values: 1836c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * <ul> 1837c4b9e0cb716a4caff218b27d86f37ef8117d257bChris Banes * <li><em>{@link #EXTRA_DOCK_STATE}</em> - the current dock 183849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * state, which depends on the state of the car mode.</li> 183949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>{@link #EXTRA_PHYSICAL_DOCK_STATE}</em> - the physical dock 184049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * state.</li> 184149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <li><em>{@link #EXTRA_CAR_MODE_ENABLED}</em> - a boolean indicating the 184249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * state of the car mode.</li> 184349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * </ul> 184449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>This is intended for monitoring the current dock state. 184549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To launch an activity from a dock state change, use {@link #CATEGORY_CAR_DOCK} 184649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * or {@link #CATEGORY_DESK_DOCK} instead. 184749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 184849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 184949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_DOCK_EVENT = 185049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.DOCK_EVENT"; 185149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 185249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 185349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Broadcast Action: a remote intent is to be broadcasted. 185449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 185549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A remote intent is used for remote RPC between devices. The remote intent 185649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * is serialized and sent from one device to another device. The receiving 1857f3ad1351d8b40ec5defe35e79d3430ad3c384b6dChris Banes * device parses the remote intent and broadcasts it. Note that anyone can 185849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * broadcast a remote intent. However, if the intent receiver of the remote intent 185949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * does not trust intent broadcasts from arbitrary intent senders, it should require 186049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the sender to hold certain permissions so only trusted sender's broadcast will be 186149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * let through. 186249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 186349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 186449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_REMOTE_INTENT = 186549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "com.google.android.pushmessaging.intent.RECEIVE"; 186649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 186749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 18687325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * Broadcast Action: hook for permforming cleanup after a system update. 186949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 187049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The broadcast is sent when the system is booting, before the 187149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * BOOT_COMPLETED broadcast. It is only sent to receivers in the system 187249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * image. A receiver for this should do its work and then disable itself 187349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * so that it does not get run again at the next boot. 187449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @hide 187549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 187649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String ACTION_PRE_BOOT_COMPLETED = 187749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.action.PRE_BOOT_COMPLETED"; 187849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 187949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // --------------------------------------------------------------------- 188049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // --------------------------------------------------------------------- 188149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // Standard intent categories (see addCategory()). 188249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 188349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 188449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set if the activity should be an option for the default action 188549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * (center press) to perform on a piece of data. Setting this will 188649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * hide from the user any activities without it set when performing an 188749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * action on some data. Note that this is normal -not- set in the 188849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Intent when initiating an action -- it is for use in intent filters 188949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * specified in packages. 189049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 189149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 189249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT"; 189349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 189449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Activities that can be safely invoked from a browser must support this 189549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * category. For example, if the user is viewing a web page or an e-mail 189649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * and clicks on a link in the text, the Intent generated execute that 189749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * link will require the BROWSABLE category, so that only activities 189849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * supporting this category will be considered as possible actions. By 189949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * supporting this category, you are promising that there is nothing 190049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * damaging (without user intervention) that can happen by invoking any 190149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * matching Intent. 190249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 190349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 190449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE"; 190549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 190649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set if the activity should be considered as an alternative action to 190749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * the data the user is currently viewing. See also 190849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #CATEGORY_SELECTED_ALTERNATIVE} for an alternative action that 190949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * applies to the selection in a list of items. 191049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 191149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>Supporting this category means that you would like your activity to be 191249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * displayed in the set of alternative things the user can do, usually as 191349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * part of the current activity's options menu. You will usually want to 191449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * include a specific label in the <intent-filter> of this action 1915174b5f1e907abbaa70f94dc83fff86ea453d2cd3Chris Banes * describing to the user what it does. 1916174b5f1e907abbaa70f94dc83fff86ea453d2cd3Chris Banes * 1917174b5f1e907abbaa70f94dc83fff86ea453d2cd3Chris Banes * <p>The action of IntentFilter with this category is important in that it 1918ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * describes the specific action the target will perform. This generally 191949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * should not be a generic action (such as {@link #ACTION_VIEW}, but rather 192049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a specific name such as "com.android.camera.action.CROP. Only one 1921ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * alternative of any particular action will be shown to the user, so using 1922ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * a specific action like this makes sure that your alternative will be 192349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * displayed while also allowing other applications to provide their own 192449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * overrides of that particular action. 192549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 192649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 192749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE"; 192849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 192949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set if the activity should be considered as an alternative selection 193049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * action to the data the user has currently selected. This is like 193149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #CATEGORY_ALTERNATIVE}, but is used in activities showing a list 1932ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * of items from which the user can select, giving them alternatives to the 1933ac00a989afc2f1c559fc33174f481a0a0ef5b3d8Chris Banes * default action that will be performed on it. 193449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 193549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 193649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE"; 193749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 193849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Intended to be used as a tab inside of an containing TabActivity. 193949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 194049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 194149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_TAB = "android.intent.category.TAB"; 194249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 194349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Should be displayed in the top-level launcher. 194449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 194549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 194649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"; 194749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 194849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Provides information about the package it is in; typically used if 194949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a package does not contain a {@link #CATEGORY_LAUNCHER} to provide 195049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * a front-door to the user without having to be shown in the all apps list. 195149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 195249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 195349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_INFO = "android.intent.category.INFO"; 195449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 195549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This is the home activity, that is the first activity that is displayed 195649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * when the device boots. 195749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 195849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 195949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_HOME = "android.intent.category.HOME"; 196049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 196149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This activity is a preference panel. 196249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 196349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 196449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE"; 196549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 196649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This activity is a development preference panel. 196749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 196849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 196949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE"; 197049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 197149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Capable of running inside a parent activity container. 197249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 197349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 197449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_EMBED = "android.intent.category.EMBED"; 197549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 197649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * This activity may be exercised by the monkey or other automated test tools. 197749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 197849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 197949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_MONKEY = "android.intent.category.MONKEY"; 198049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 198149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To be used as a test (not part of the normal user experience). 198249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 198349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_TEST = "android.intent.category.TEST"; 198449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 198549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To be used as a unit test (run through the Test Harness). 198649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 198749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST"; 198849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 198949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To be used as an sample code example (not part of the normal user 199049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * experience). 199149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 199249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE"; 199349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 199449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Used to indicate that a GET_CONTENT intent only wants URIs that can be opened with 199549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * ContentResolver.openInputStream. Openable URIs must support the columns in OpenableColumns 199649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * when queried, though it is allowable for those columns to be blank. 199749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 199849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 199949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_OPENABLE = "android.intent.category.OPENABLE"; 200049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 200149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 200249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To be used as code under test for framework instrumentation tests. 200349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 200449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = 200549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; 200649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 200749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * An activity to run when device is inserted into a car dock. 200849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Used with {@link #ACTION_MAIN} to launch an activity. 200949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To monitor dock state, use {@link #ACTION_DOCK_EVENT} instead. 201049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 201149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 201249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK"; 201349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 201449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * An activity to run when device is inserted into a car dock. 201549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Used with {@link #ACTION_MAIN} to launch an activity. 201649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * To monitor dock state, use {@link #ACTION_DOCK_EVENT} instead. 201749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 201849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @SdkConstant(SdkConstantType.INTENT_CATEGORY) 201949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK"; 202049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 202149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // --------------------------------------------------------------------- 202249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // --------------------------------------------------------------------- 202349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes // Standard extra data keys. 202449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 2025f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell /** 202649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The initial data to place in a newly created record. Use with 202749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #ACTION_INSERT}. The data here is a Map containing the same 202849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * fields as would be given to the underlying ContentProvider.insert() 202949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * call. 203049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 203149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"; 203249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 203349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 203449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A constant CharSequence that is associated with the Intent, used with 203549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link #ACTION_SEND} to supply the literal data to be sent. Note that 203649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * this may be a styled CharSequence, so you must use 203749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to 203849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * retrieve it. 203949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 204049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_TEXT = "android.intent.extra.TEXT"; 204149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 204249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 204349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A content: URI holding a stream of data associated with the Intent, 204449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * used with {@link #ACTION_SEND} to supply the data being sent. 204549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 204649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_STREAM = "android.intent.extra.STREAM"; 204749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 2048f6ad5d5a5d205696951a04c49dc04fa65a428e58Adam Powell /** 204949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A String[] holding e-mail addresses that should be delivered to. 205049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 205149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_EMAIL = "android.intent.extra.EMAIL"; 205249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 205349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 205449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A String[] holding e-mail addresses that should be carbon copied. 205549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 205649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_CC = "android.intent.extra.CC"; 205749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 205849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 205949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A String[] holding e-mail addresses that should be blind carbon copied. 206049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 206149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_BCC = "android.intent.extra.BCC"; 206249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 206349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 206449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * A constant string holding the desired subject line of a message. 206549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 206649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static final String EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; 206749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 206849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 206949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * An Intent describing the choices you would like shown with 20707325cdad103472c460c1dd492ec9f9ac0df57d50Chris Banes * {@link #ACTION_PICK_ACTIVITY}. 2071fc652f469994757b243ef66148c064973af196c7Ben Murdoch */ 2072 public static final String EXTRA_INTENT = "android.intent.extra.INTENT"; 2073 2074 /** 2075 * A CharSequence dialog title to provide to the user when used with a 2076 * {@link #ACTION_CHOOSER}. 2077 */ 2078 public static final String EXTRA_TITLE = "android.intent.extra.TITLE"; 2079 2080 /** 2081 * A Parcelable[] of {@link Intent} or 2082 * {@link android.content.pm.LabeledIntent} objects as set with 2083 * {@link #putExtra(String, Parcelable[])} of additional activities to place 2084 * a the front of the list of choices, when shown to the user with a 2085 * {@link #ACTION_CHOOSER}. 2086 */ 2087 public static final String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS"; 2088 2089 /** 2090 * A {@link android.view.KeyEvent} object containing the event that 2091 * triggered the creation of the Intent it is in. 2092 */ 2093 public static final String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"; 2094 2095 /** 2096 * Set to true in {@link #ACTION_REQUEST_SHUTDOWN} to request confirmation from the user 2097 * before shutting down. 2098 * 2099 * {@hide} 2100 */ 2101 public static final String EXTRA_KEY_CONFIRM = "android.intent.extra.KEY_CONFIRM"; 2102 2103 /** 2104 * Used as an boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or 2105 * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} intents to override the default action 2106 * of restarting the application. 2107 */ 2108 public static final String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP"; 2109 2110 /** 2111 * A String holding the phone number originally entered in 2112 * {@link android.content.Intent#ACTION_NEW_OUTGOING_CALL}, or the actual 2113 * number to call in a {@link android.content.Intent#ACTION_CALL}. 2114 */ 2115 public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; 2116 2117 /** 2118 * Used as an int extra field in {@link android.content.Intent#ACTION_UID_REMOVED} 2119 * intents to supply the uid the package had been assigned. Also an optional 2120 * extra in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or 2121 * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} for the same 2122 * purpose. 2123 */ 2124 public static final String EXTRA_UID = "android.intent.extra.UID"; 2125 2126 /** 2127 * @hide String array of package names. 2128 */ 2129 public static final String EXTRA_PACKAGES = "android.intent.extra.PACKAGES"; 2130 2131 /** 2132 * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} 2133 * intents to indicate whether this represents a full uninstall (removing 2134 * both the code and its data) or a partial uninstall (leaving its data, 2135 * implying that this is an update). 2136 */ 2137 public static final String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED"; 2138 2139 /** 2140 * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} 2141 * intents to indicate that this is a replacement of the package, so this 2142 * broadcast will immediately be followed by an add broadcast for a 2143 * different version of the same package. 2144 */ 2145 public static final String EXTRA_REPLACING = "android.intent.extra.REPLACING"; 2146 2147 /** 2148 * Used as an int extra field in {@link android.app.AlarmManager} intents 2149 * to tell the application being invoked how many pending alarms are being 2150 * delievered with the intent. For one-shot alarms this will always be 1. 2151 * For recurring alarms, this might be greater than 1 if the device was 2152 * asleep or powered off at the time an earlier alarm would have been 2153 * delivered. 2154 */ 2155 public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"; 2156 2157 /** 2158 * Used as an int extra field in {@link android.content.Intent#ACTION_DOCK_EVENT} 2159 * intents to request the dock state. Possible values are 2160 * {@link android.content.Intent#EXTRA_DOCK_STATE_UNDOCKED}, 2161 * {@link android.content.Intent#EXTRA_DOCK_STATE_DESK}, or 2162 * {@link android.content.Intent#EXTRA_DOCK_STATE_CAR}. 2163 */ 2164 public static final String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE"; 2165 2166 /** 2167 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2168 * to represent that the phone is not in any dock. 2169 */ 2170 public static final int EXTRA_DOCK_STATE_UNDOCKED = 0; 2171 2172 /** 2173 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2174 * to represent that the phone is in a desk dock. 2175 */ 2176 public static final int EXTRA_DOCK_STATE_DESK = 1; 2177 2178 /** 2179 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2180 * to represent that the phone is in a car dock. 2181 */ 2182 public static final int EXTRA_DOCK_STATE_CAR = 2; 2183 2184 /** 2185 * Used as an int extra field in {@link android.content.Intent#ACTION_DOCK_EVENT} 2186 * intents to request the physical dock state. Possible values are 2187 * {@link android.content.Intent#EXTRA_DOCK_STATE_UNDOCKED}, 2188 * {@link android.content.Intent#EXTRA_DOCK_STATE_DESK}, or 2189 * {@link android.content.Intent#EXTRA_DOCK_STATE_CAR}. 2190 */ 2191 public static final String EXTRA_PHYSICAL_DOCK_STATE = 2192 "android.intent.extra.PHYSICAL_DOCK_STATE"; 2193 2194 /** 2195 * Used as an boolean extra field in {@link android.content.Intent#ACTION_DOCK_EVENT} 2196 * intents to indicate that the car mode is enabled or not. 2197 */ 2198 public static final String EXTRA_CAR_MODE_ENABLED = "android.intent.extra.CAR_MODE_ENABLED"; 2199 2200 /** 2201 * Boolean that can be supplied as meta-data with a dock activity, to 2202 * indicate that the dock should take over the home key when it is active. 2203 */ 2204 public static final String METADATA_DOCK_HOME = "android.dock_home"; 2205 2206 /** 2207 * Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing 2208 * the bug report. 2209 * 2210 * @hide 2211 */ 2212 public static final String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT"; 2213 2214 /** 2215 * Used as a string extra field when sending an intent to PackageInstaller to install a 2216 * package. Specifies the installer package name; this package will receive the 2217 * {@link #ACTION_APP_ERROR} intent. 2218 * 2219 * @hide 2220 */ 2221 public static final String EXTRA_INSTALLER_PACKAGE_NAME 2222 = "android.intent.extra.INSTALLER_PACKAGE_NAME"; 2223 2224 /** 2225 * Used in the extra field in the remote intent. It's astring token passed with the 2226 * remote intent. 2227 */ 2228 public static final String EXTRA_REMOTE_INTENT_TOKEN = 2229 "android.intent.extra.remote_intent_token"; 2230 2231 /** 2232 * @deprecated See {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST}; this field 2233 * will contain only the first name in the list. 2234 */ 2235 @Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME = 2236 "android.intent.extra.changed_component_name"; 2237 2238 /** 2239 * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED}, 2240 * and contains a string array of all of the components that have changed. 2241 */ 2242 public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST = 2243 "android.intent.extra.changed_component_name_list"; 2244 2245 /** 2246 * This field is part of 2247 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, 2248 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE} 2249 * and contains a string array of all of the components that have changed. 2250 * @hide 2251 */ 2252 public static final String EXTRA_CHANGED_PACKAGE_LIST = 2253 "android.intent.extra.changed_package_list"; 2254 2255 /** 2256 * This field is part of 2257 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, 2258 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE} 2259 * and contains an integer array of uids of all of the components 2260 * that have changed. 2261 * @hide 2262 */ 2263 public static final String EXTRA_CHANGED_UID_LIST = 2264 "android.intent.extra.changed_uid_list"; 2265 2266 /** 2267 * @hide 2268 * Magic extra system code can use when binding, to give a label for 2269 * who it is that has bound to a service. This is an integer giving 2270 * a framework string resource that can be displayed to the user. 2271 */ 2272 public static final String EXTRA_CLIENT_LABEL = 2273 "android.intent.extra.client_label"; 2274 2275 /** 2276 * @hide 2277 * Magic extra system code can use when binding, to give a PendingIntent object 2278 * that can be launched for the user to disable the system's use of this 2279 * service. 2280 */ 2281 public static final String EXTRA_CLIENT_INTENT = 2282 "android.intent.extra.client_intent"; 2283 2284 // --------------------------------------------------------------------- 2285 // --------------------------------------------------------------------- 2286 // Intent flags (see mFlags variable). 2287 2288 /** 2289 * If set, the recipient of this Intent will be granted permission to 2290 * perform read operations on the Uri in the Intent's data. 2291 */ 2292 public static final int FLAG_GRANT_READ_URI_PERMISSION = 0x00000001; 2293 /** 2294 * If set, the recipient of this Intent will be granted permission to 2295 * perform write operations on the Uri in the Intent's data. 2296 */ 2297 public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002; 2298 /** 2299 * Can be set by the caller to indicate that this Intent is coming from 2300 * a background operation, not from direct user interaction. 2301 */ 2302 public static final int FLAG_FROM_BACKGROUND = 0x00000004; 2303 /** 2304 * A flag you can enable for debugging: when set, log messages will be 2305 * printed during the resolution of this intent to show you what has 2306 * been found to create the final resolved list. 2307 */ 2308 public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008; 2309 2310 /** 2311 * If set, the new activity is not kept in the history stack. As soon as 2312 * the user navigates away from it, the activity is finished. This may also 2313 * be set with the {@link android.R.styleable#AndroidManifestActivity_noHistory 2314 * noHistory} attribute. 2315 */ 2316 public static final int FLAG_ACTIVITY_NO_HISTORY = 0x40000000; 2317 /** 2318 * If set, the activity will not be launched if it is already running 2319 * at the top of the history stack. 2320 */ 2321 public static final int FLAG_ACTIVITY_SINGLE_TOP = 0x20000000; 2322 /** 2323 * If set, this activity will become the start of a new task on this 2324 * history stack. A task (from the activity that started it to the 2325 * next task activity) defines an atomic group of activities that the 2326 * user can move to. Tasks can be moved to the foreground and background; 2327 * all of the activities inside of a particular task always remain in 2328 * the same order. See 2329 * <a href="{@docRoot}guide/topics/fundamentals.html#acttask">Application Fundamentals: 2330 * Activities and Tasks</a> for more details on tasks. 2331 * 2332 * <p>This flag is generally used by activities that want 2333 * to present a "launcher" style behavior: they give the user a list of 2334 * separate things that can be done, which otherwise run completely 2335 * independently of the activity launching them. 2336 * 2337 * <p>When using this flag, if a task is already running for the activity 2338 * you are now starting, then a new activity will not be started; instead, 2339 * the current task will simply be brought to the front of the screen with 2340 * the state it was last in. See {@link #FLAG_ACTIVITY_MULTIPLE_TASK} for a flag 2341 * to disable this behavior. 2342 * 2343 * <p>This flag can not be used when the caller is requesting a result from 2344 * the activity being launched. 2345 */ 2346 public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000; 2347 /** 2348 * <strong>Do not use this flag unless you are implementing your own 2349 * top-level application launcher.</strong> Used in conjunction with 2350 * {@link #FLAG_ACTIVITY_NEW_TASK} to disable the 2351 * behavior of bringing an existing task to the foreground. When set, 2352 * a new task is <em>always</em> started to host the Activity for the 2353 * Intent, regardless of whether there is already an existing task running 2354 * the same thing. 2355 * 2356 * <p><strong>Because the default system does not include graphical task management, 2357 * you should not use this flag unless you provide some way for a user to 2358 * return back to the tasks you have launched.</strong> 2359 * 2360 * <p>This flag is ignored if 2361 * {@link #FLAG_ACTIVITY_NEW_TASK} is not set. 2362 * 2363 * <p>See <a href="{@docRoot}guide/topics/fundamentals.html#acttask">Application Fundamentals: 2364 * Activities and Tasks</a> for more details on tasks. 2365 */ 2366 public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000; 2367 /** 2368 * If set, and the activity being launched is already running in the 2369 * current task, then instead of launching a new instance of that activity, 2370 * all of the other activities on top of it will be closed and this Intent 2371 * will be delivered to the (now on top) old activity as a new Intent. 2372 * 2373 * <p>For example, consider a task consisting of the activities: A, B, C, D. 2374 * If D calls startActivity() with an Intent that resolves to the component 2375 * of activity B, then C and D will be finished and B receive the given 2376 * Intent, resulting in the stack now being: A, B. 2377 * 2378 * <p>The currently running instance of activity B in the above example will 2379 * either receive the new intent you are starting here in its 2380 * onNewIntent() method, or be itself finished and restarted with the 2381 * new intent. If it has declared its launch mode to be "multiple" (the 2382 * default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in 2383 * the same intent, then it will be finished and re-created; for all other 2384 * launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this 2385 * Intent will be delivered to the current instance's onNewIntent(). 2386 * 2387 * <p>This launch mode can also be used to good effect in conjunction with 2388 * {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity 2389 * of a task, it will bring any currently running instance of that task 2390 * to the foreground, and then clear it to its root state. This is 2391 * especially useful, for example, when launching an activity from the 2392 * notification manager. 2393 * 2394 * <p>See <a href="{@docRoot}guide/topics/fundamentals.html#acttask">Application Fundamentals: 2395 * Activities and Tasks</a> for more details on tasks. 2396 */ 2397 public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000; 2398 /** 2399 * If set and this intent is being used to launch a new activity from an 2400 * existing one, then the reply target of the existing activity will be 2401 * transfered to the new activity. This way the new activity can call 2402 * {@link android.app.Activity#setResult} and have that result sent back to 2403 * the reply target of the original activity. 2404 */ 2405 public static final int FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000; 2406 /** 2407 * If set and this intent is being used to launch a new activity from an 2408 * existing one, the current activity will not be counted as the top 2409 * activity for deciding whether the new intent should be delivered to 2410 * the top instead of starting a new one. The previous activity will 2411 * be used as the top, with the assumption being that the current activity 2412 * will finish itself immediately. 2413 */ 2414 public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 0x01000000; 2415 /** 2416 * If set, the new activity is not kept in the list of recently launched 2417 * activities. 2418 */ 2419 public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000; 2420 /** 2421 * This flag is not normally set by application code, but set for you by 2422 * the system as described in the 2423 * {@link android.R.styleable#AndroidManifestActivity_launchMode 2424 * launchMode} documentation for the singleTask mode. 2425 */ 2426 public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 0x00400000; 2427 /** 2428 * If set, and this activity is either being started in a new task or 2429 * bringing to the top an existing task, then it will be launched as 2430 * the front door of the task. This will result in the application of 2431 * any affinities needed to have that task in the proper state (either 2432 * moving activities to or from it), or simply resetting that task to 2433 * its initial state if needed. 2434 */ 2435 public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000; 2436 /** 2437 * This flag is not normally set by application code, but set for you by 2438 * the system if this activity is being launched from history 2439 * (longpress home key). 2440 */ 2441 public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 0x00100000; 2442 /** 2443 * If set, this marks a point in the task's activity stack that should 2444 * be cleared when the task is reset. That is, the next time the task 2445 * is brought to the foreground with 2446 * {@link #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED} (typically as a result of 2447 * the user re-launching it from home), this activity and all on top of 2448 * it will be finished so that the user does not return to them, but 2449 * instead returns to whatever activity preceeded it. 2450 * 2451 * <p>This is useful for cases where you have a logical break in your 2452 * application. For example, an e-mail application may have a command 2453 * to view an attachment, which launches an image view activity to 2454 * display it. This activity should be part of the e-mail application's 2455 * task, since it is a part of the task the user is involved in. However, 2456 * if the user leaves that task, and later selects the e-mail app from 2457 * home, we may like them to return to the conversation they were 2458 * viewing, not the picture attachment, since that is confusing. By 2459 * setting this flag when launching the image viewer, that viewer and 2460 * any activities it starts will be removed the next time the user returns 2461 * to mail. 2462 */ 2463 public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000; 2464 /** 2465 * If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaveHint} 2466 * callback from occurring on the current frontmost activity before it is 2467 * paused as the newly-started activity is brought to the front. 2468 * 2469 * <p>Typically, an activity can rely on that callback to indicate that an 2470 * explicit user action has caused their activity to be moved out of the 2471 * foreground. The callback marks an appropriate point in the activity's 2472 * lifecycle for it to dismiss any notifications that it intends to display 2473 * "until the user has seen them," such as a blinking LED. 2474 * 2475 * <p>If an activity is ever started via any non-user-driven events such as 2476 * phone-call receipt or an alarm handler, this flag should be passed to {@link 2477 * Context#startActivity Context.startActivity}, ensuring that the pausing 2478 * activity does not think the user has acknowledged its notification. 2479 */ 2480 public static final int FLAG_ACTIVITY_NO_USER_ACTION = 0x00040000; 2481 /** 2482 * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, 2483 * this flag will cause the launched activity to be brought to the front of its 2484 * task's history stack if it is already running. 2485 * 2486 * <p>For example, consider a task consisting of four activities: A, B, C, D. 2487 * If D calls startActivity() with an Intent that resolves to the component 2488 * of activity B, then B will be brought to the front of the history stack, 2489 * with this resulting order: A, C, D, B. 2490 * 2491 * This flag will be ignored if {@link #FLAG_ACTIVITY_CLEAR_TOP} is also 2492 * specified. 2493 */ 2494 public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 0X00020000; 2495 /** 2496 * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, 2497 * this flag will prevent the system from applying an activity transition 2498 * animation to go to the next activity state. This doesn't mean an 2499 * animation will never run -- if another activity change happens that doesn't 2500 * specify this flag before the activity started here is displayed, then 2501 * that transition will be used. This this flag can be put to good use 2502 * when you are going to do a series of activity operations but the 2503 * animation seen by the user shouldn't be driven by the first activity 2504 * change but rather a later one. 2505 */ 2506 public static final int FLAG_ACTIVITY_NO_ANIMATION = 0X00010000; 2507 /** 2508 * If set, when sending a broadcast only registered receivers will be 2509 * called -- no BroadcastReceiver components will be launched. 2510 */ 2511 public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000; 2512 /** 2513 * If set, when sending a broadcast the new broadcast will replace 2514 * any existing pending broadcast that matches it. Matching is defined 2515 * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning 2516 * true for the intents of the two broadcasts. When a match is found, 2517 * the new broadcast (and receivers associated with it) will replace the 2518 * existing one in the pending broadcast list, remaining at the same 2519 * position in the list. 2520 * 2521 * <p>This flag is most typically used with sticky broadcasts, which 2522 * only care about delivering the most recent values of the broadcast 2523 * to their receivers. 2524 */ 2525 public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000; 2526 /** 2527 * If set, when sending a broadcast <i>before boot has completed</i> only 2528 * registered receivers will be called -- no BroadcastReceiver components 2529 * will be launched. Sticky intent state will be recorded properly even 2530 * if no receivers wind up being called. If {@link #FLAG_RECEIVER_REGISTERED_ONLY} 2531 * is specified in the broadcast intent, this flag is unnecessary. 2532 * 2533 * <p>This flag is only for use by system sevices as a convenience to 2534 * avoid having to implement a more complex mechanism around detection 2535 * of boot completion. 2536 * 2537 * @hide 2538 */ 2539 public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x10000000; 2540 /** 2541 * Set when this broadcast is for a boot upgrade, a special mode that 2542 * allows the broadcast to be sent before the system is ready and launches 2543 * the app process with no providers running in it. 2544 * @hide 2545 */ 2546 public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x08000000; 2547 2548 /** 2549 * @hide Flags that can't be changed with PendingIntent. 2550 */ 2551 public static final int IMMUTABLE_FLAGS = 2552 FLAG_GRANT_READ_URI_PERMISSION 2553 | FLAG_GRANT_WRITE_URI_PERMISSION; 2554 2555 // --------------------------------------------------------------------- 2556 // --------------------------------------------------------------------- 2557 // toUri() and parseUri() options. 2558 2559 /** 2560 * Flag for use with {@link #toUri} and {@link #parseUri}: the URI string 2561 * always has the "intent:" scheme. This syntax can be used when you want 2562 * to later disambiguate between URIs that are intended to describe an 2563 * Intent vs. all others that should be treated as raw URIs. When used 2564 * with {@link #parseUri}, any other scheme will result in a generic 2565 * VIEW action for that raw URI. 2566 */ 2567 public static final int URI_INTENT_SCHEME = 1<<0; 2568 2569 // --------------------------------------------------------------------- 2570 2571 private String mAction; 2572 private Uri mData; 2573 private String mType; 2574 private String mPackage; 2575 private ComponentName mComponent; 2576 private int mFlags; 2577 private HashSet<String> mCategories; 2578 private Bundle mExtras; 2579 private Rect mSourceBounds; 2580 2581 // --------------------------------------------------------------------- 2582 2583 /** 2584 * Create an empty intent. 2585 */ 2586 public Intent() { 2587 } 2588 2589 /** 2590 * Copy constructor. 2591 */ 2592 public Intent(Intent o) { 2593 this.mAction = o.mAction; 2594 this.mData = o.mData; 2595 this.mType = o.mType; 2596 this.mPackage = o.mPackage; 2597 this.mComponent = o.mComponent; 2598 this.mFlags = o.mFlags; 2599 if (o.mCategories != null) { 2600 this.mCategories = new HashSet<String>(o.mCategories); 2601 } 2602 if (o.mExtras != null) { 2603 this.mExtras = new Bundle(o.mExtras); 2604 } 2605 if (o.mSourceBounds != null) { 2606 this.mSourceBounds = new Rect(o.mSourceBounds); 2607 } 2608 } 2609 2610 @Override 2611 public Object clone() { 2612 return new Intent(this); 2613 } 2614 2615 private Intent(Intent o, boolean all) { 2616 this.mAction = o.mAction; 2617 this.mData = o.mData; 2618 this.mType = o.mType; 2619 this.mPackage = o.mPackage; 2620 this.mComponent = o.mComponent; 2621 if (o.mCategories != null) { 2622 this.mCategories = new HashSet<String>(o.mCategories); 2623 } 2624 } 2625 2626 /** 2627 * Make a clone of only the parts of the Intent that are relevant for 2628 * filter matching: the action, data, type, component, and categories. 2629 */ 2630 public Intent cloneFilter() { 2631 return new Intent(this, false); 2632 } 2633 2634 /** 2635 * Create an intent with a given action. All other fields (data, type, 2636 * class) are null. Note that the action <em>must</em> be in a 2637 * namespace because Intents are used globally in the system -- for 2638 * example the system VIEW action is android.intent.action.VIEW; an 2639 * application's custom action would be something like 2640 * com.google.app.myapp.CUSTOM_ACTION. 2641 * 2642 * @param action The Intent action, such as ACTION_VIEW. 2643 */ 2644 public Intent(String action) { 2645 mAction = action; 2646 } 2647 2648 /** 2649 * Create an intent with a given action and for a given data url. Note 2650 * that the action <em>must</em> be in a namespace because Intents are 2651 * used globally in the system -- for example the system VIEW action is 2652 * android.intent.action.VIEW; an application's custom action would be 2653 * something like com.google.app.myapp.CUSTOM_ACTION. 2654 * 2655 * <p><em>Note: scheme and host name matching in the Android framework is 2656 * case-sensitive, unlike the formal RFC. As a result, 2657 * you should always ensure that you write your Uri with these elements 2658 * using lower case letters, and normalize any Uris you receive from 2659 * outside of Android to ensure the scheme and host is lower case.</em></p> 2660 * 2661 * @param action The Intent action, such as ACTION_VIEW. 2662 * @param uri The Intent data URI. 2663 */ 2664 public Intent(String action, Uri uri) { 2665 mAction = action; 2666 mData = uri; 2667 } 2668 2669 /** 2670 * Create an intent for a specific component. All other fields (action, data, 2671 * type, class) are null, though they can be modified later with explicit 2672 * calls. This provides a convenient way to create an intent that is 2673 * intended to execute a hard-coded class name, rather than relying on the 2674 * system to find an appropriate class for you; see {@link #setComponent} 2675 * for more information on the repercussions of this. 2676 * 2677 * @param packageContext A Context of the application package implementing 2678 * this class. 2679 * @param cls The component class that is to be used for the intent. 2680 * 2681 * @see #setClass 2682 * @see #setComponent 2683 * @see #Intent(String, android.net.Uri , Context, Class) 2684 */ 2685 public Intent(Context packageContext, Class<?> cls) { 2686 mComponent = new ComponentName(packageContext, cls); 2687 } 2688 2689 /** 2690 * Create an intent for a specific component with a specified action and data. 2691 * This is equivalent using {@link #Intent(String, android.net.Uri)} to 2692 * construct the Intent and then calling {@link #setClass} to set its 2693 * class. 2694 * 2695 * <p><em>Note: scheme and host name matching in the Android framework is 2696 * case-sensitive, unlike the formal RFC. As a result, 2697 * you should always ensure that you write your Uri with these elements 2698 * using lower case letters, and normalize any Uris you receive from 2699 * outside of Android to ensure the scheme and host is lower case.</em></p> 2700 * 2701 * @param action The Intent action, such as ACTION_VIEW. 2702 * @param uri The Intent data URI. 2703 * @param packageContext A Context of the application package implementing 2704 * this class. 2705 * @param cls The component class that is to be used for the intent. 2706 * 2707 * @see #Intent(String, android.net.Uri) 2708 * @see #Intent(Context, Class) 2709 * @see #setClass 2710 * @see #setComponent 2711 */ 2712 public Intent(String action, Uri uri, 2713 Context packageContext, Class<?> cls) { 2714 mAction = action; 2715 mData = uri; 2716 mComponent = new ComponentName(packageContext, cls); 2717 } 2718 2719 /** 2720 * Call {@link #parseUri} with 0 flags. 2721 * @deprecated Use {@link #parseUri} instead. 2722 */ 2723 @Deprecated 2724 public static Intent getIntent(String uri) throws URISyntaxException { 2725 return parseUri(uri, 0); 2726 } 2727 2728 /** 2729 * Create an intent from a URI. This URI may encode the action, 2730 * category, and other intent fields, if it was returned by 2731 * {@link #toUri}. If the Intent was not generate by toUri(), its data 2732 * will be the entire URI and its action will be ACTION_VIEW. 2733 * 2734 * <p>The URI given here must not be relative -- that is, it must include 2735 * the scheme and full path. 2736 * 2737 * @param uri The URI to turn into an Intent. 2738 * @param flags Additional processing flags. Either 0 or 2739 * {@link #URI_INTENT_SCHEME}. 2740 * 2741 * @return Intent The newly created Intent object. 2742 * 2743 * @throws URISyntaxException Throws URISyntaxError if the basic URI syntax 2744 * it bad (as parsed by the Uri class) or the Intent data within the 2745 * URI is invalid. 2746 * 2747 * @see #toUri 2748 */ 2749 public static Intent parseUri(String uri, int flags) throws URISyntaxException { 2750 int i = 0; 2751 try { 2752 // Validate intent scheme for if requested. 2753 if ((flags&URI_INTENT_SCHEME) != 0) { 2754 if (!uri.startsWith("intent:")) { 2755 Intent intent = new Intent(ACTION_VIEW); 2756 try { 2757 intent.setData(Uri.parse(uri)); 2758 } catch (IllegalArgumentException e) { 2759 throw new URISyntaxException(uri, e.getMessage()); 2760 } 2761 return intent; 2762 } 2763 } 2764 2765 // simple case 2766 i = uri.lastIndexOf("#"); 2767 if (i == -1) return new Intent(ACTION_VIEW, Uri.parse(uri)); 2768 2769 // old format Intent URI 2770 if (!uri.startsWith("#Intent;", i)) return getIntentOld(uri); 2771 2772 // new format 2773 Intent intent = new Intent(ACTION_VIEW); 2774 2775 // fetch data part, if present 2776 String data = i >= 0 ? uri.substring(0, i) : null; 2777 String scheme = null; 2778 i += "#Intent;".length(); 2779 2780 // loop over contents of Intent, all name=value; 2781 while (!uri.startsWith("end", i)) { 2782 int eq = uri.indexOf('=', i); 2783 int semi = uri.indexOf(';', eq); 2784 String value = Uri.decode(uri.substring(eq + 1, semi)); 2785 2786 // action 2787 if (uri.startsWith("action=", i)) { 2788 intent.mAction = value; 2789 } 2790 2791 // categories 2792 else if (uri.startsWith("category=", i)) { 2793 intent.addCategory(value); 2794 } 2795 2796 // type 2797 else if (uri.startsWith("type=", i)) { 2798 intent.mType = value; 2799 } 2800 2801 // launch flags 2802 else if (uri.startsWith("launchFlags=", i)) { 2803 intent.mFlags = Integer.decode(value).intValue(); 2804 } 2805 2806 // package 2807 else if (uri.startsWith("package=", i)) { 2808 intent.mPackage = value; 2809 } 2810 2811 // component 2812 else if (uri.startsWith("component=", i)) { 2813 intent.mComponent = ComponentName.unflattenFromString(value); 2814 } 2815 2816 // scheme 2817 else if (uri.startsWith("scheme=", i)) { 2818 scheme = value; 2819 } 2820 2821 // source bounds 2822 else if (uri.startsWith("sourceBounds=", i)) { 2823 intent.mSourceBounds = Rect.unflattenFromString(value); 2824 } 2825 2826 // extra 2827 else { 2828 String key = Uri.decode(uri.substring(i + 2, eq)); 2829 // create Bundle if it doesn't already exist 2830 if (intent.mExtras == null) intent.mExtras = new Bundle(); 2831 Bundle b = intent.mExtras; 2832 // add EXTRA 2833 if (uri.startsWith("S.", i)) b.putString(key, value); 2834 else if (uri.startsWith("B.", i)) b.putBoolean(key, Boolean.parseBoolean(value)); 2835 else if (uri.startsWith("b.", i)) b.putByte(key, Byte.parseByte(value)); 2836 else if (uri.startsWith("c.", i)) b.putChar(key, value.charAt(0)); 2837 else if (uri.startsWith("d.", i)) b.putDouble(key, Double.parseDouble(value)); 2838 else if (uri.startsWith("f.", i)) b.putFloat(key, Float.parseFloat(value)); 2839 else if (uri.startsWith("i.", i)) b.putInt(key, Integer.parseInt(value)); 2840 else if (uri.startsWith("l.", i)) b.putLong(key, Long.parseLong(value)); 2841 else if (uri.startsWith("s.", i)) b.putShort(key, Short.parseShort(value)); 2842 else throw new URISyntaxException(uri, "unknown EXTRA type", i); 2843 } 2844 2845 // move to the next item 2846 i = semi + 1; 2847 } 2848 2849 if (data != null) { 2850 if (data.startsWith("intent:")) { 2851 data = data.substring(7); 2852 if (scheme != null) { 2853 data = scheme + ':' + data; 2854 } 2855 } 2856 2857 if (data.length() > 0) { 2858 try { 2859 intent.mData = Uri.parse(data); 2860 } catch (IllegalArgumentException e) { 2861 throw new URISyntaxException(uri, e.getMessage()); 2862 } 2863 } 2864 } 2865 2866 return intent; 2867 2868 } catch (IndexOutOfBoundsException e) { 2869 throw new URISyntaxException(uri, "illegal Intent URI format", i); 2870 } 2871 } 2872 2873 public static Intent getIntentOld(String uri) throws URISyntaxException { 2874 Intent intent; 2875 2876 int i = uri.lastIndexOf('#'); 2877 if (i >= 0) { 2878 String action = null; 2879 final int intentFragmentStart = i; 2880 boolean isIntentFragment = false; 2881 2882 i++; 2883 2884 if (uri.regionMatches(i, "action(", 0, 7)) { 2885 isIntentFragment = true; 2886 i += 7; 2887 int j = uri.indexOf(')', i); 2888 action = uri.substring(i, j); 2889 i = j + 1; 2890 } 2891 2892 intent = new Intent(action); 2893 2894 if (uri.regionMatches(i, "categories(", 0, 11)) { 2895 isIntentFragment = true; 2896 i += 11; 2897 int j = uri.indexOf(')', i); 2898 while (i < j) { 2899 int sep = uri.indexOf('!', i); 2900 if (sep < 0) sep = j; 2901 if (i < sep) { 2902 intent.addCategory(uri.substring(i, sep)); 2903 } 2904 i = sep + 1; 2905 } 2906 i = j + 1; 2907 } 2908 2909 if (uri.regionMatches(i, "type(", 0, 5)) { 2910 isIntentFragment = true; 2911 i += 5; 2912 int j = uri.indexOf(')', i); 2913 intent.mType = uri.substring(i, j); 2914 i = j + 1; 2915 } 2916 2917 if (uri.regionMatches(i, "launchFlags(", 0, 12)) { 2918 isIntentFragment = true; 2919 i += 12; 2920 int j = uri.indexOf(')', i); 2921 intent.mFlags = Integer.decode(uri.substring(i, j)).intValue(); 2922 i = j + 1; 2923 } 2924 2925 if (uri.regionMatches(i, "component(", 0, 10)) { 2926 isIntentFragment = true; 2927 i += 10; 2928 int j = uri.indexOf(')', i); 2929 int sep = uri.indexOf('!', i); 2930 if (sep >= 0 && sep < j) { 2931 String pkg = uri.substring(i, sep); 2932 String cls = uri.substring(sep + 1, j); 2933 intent.mComponent = new ComponentName(pkg, cls); 2934 } 2935 i = j + 1; 2936 } 2937 2938 if (uri.regionMatches(i, "extras(", 0, 7)) { 2939 isIntentFragment = true; 2940 i += 7; 2941 2942 final int closeParen = uri.indexOf(')', i); 2943 if (closeParen == -1) throw new URISyntaxException(uri, 2944 "EXTRA missing trailing ')'", i); 2945 2946 while (i < closeParen) { 2947 // fetch the key value 2948 int j = uri.indexOf('=', i); 2949 if (j <= i + 1 || i >= closeParen) { 2950 throw new URISyntaxException(uri, "EXTRA missing '='", i); 2951 } 2952 char type = uri.charAt(i); 2953 i++; 2954 String key = uri.substring(i, j); 2955 i = j + 1; 2956 2957 // get type-value 2958 j = uri.indexOf('!', i); 2959 if (j == -1 || j >= closeParen) j = closeParen; 2960 if (i >= j) throw new URISyntaxException(uri, "EXTRA missing '!'", i); 2961 String value = uri.substring(i, j); 2962 i = j; 2963 2964 // create Bundle if it doesn't already exist 2965 if (intent.mExtras == null) intent.mExtras = new Bundle(); 2966 2967 // add item to bundle 2968 try { 2969 switch (type) { 2970 case 'S': 2971 intent.mExtras.putString(key, Uri.decode(value)); 2972 break; 2973 case 'B': 2974 intent.mExtras.putBoolean(key, Boolean.parseBoolean(value)); 2975 break; 2976 case 'b': 2977 intent.mExtras.putByte(key, Byte.parseByte(value)); 2978 break; 2979 case 'c': 2980 intent.mExtras.putChar(key, Uri.decode(value).charAt(0)); 2981 break; 2982 case 'd': 2983 intent.mExtras.putDouble(key, Double.parseDouble(value)); 2984 break; 2985 case 'f': 2986 intent.mExtras.putFloat(key, Float.parseFloat(value)); 2987 break; 2988 case 'i': 2989 intent.mExtras.putInt(key, Integer.parseInt(value)); 2990 break; 2991 case 'l': 2992 intent.mExtras.putLong(key, Long.parseLong(value)); 2993 break; 2994 case 's': 2995 intent.mExtras.putShort(key, Short.parseShort(value)); 2996 break; 2997 default: 2998 throw new URISyntaxException(uri, "EXTRA has unknown type", i); 2999 } 3000 } catch (NumberFormatException e) { 3001 throw new URISyntaxException(uri, "EXTRA value can't be parsed", i); 3002 } 3003 3004 char ch = uri.charAt(i); 3005 if (ch == ')') break; 3006 if (ch != '!') throw new URISyntaxException(uri, "EXTRA missing '!'", i); 3007 i++; 3008 } 3009 } 3010 3011 if (isIntentFragment) { 3012 intent.mData = Uri.parse(uri.substring(0, intentFragmentStart)); 3013 } else { 3014 intent.mData = Uri.parse(uri); 3015 } 3016 3017 if (intent.mAction == null) { 3018 // By default, if no action is specified, then use VIEW. 3019 intent.mAction = ACTION_VIEW; 3020 } 3021 3022 } else { 3023 intent = new Intent(ACTION_VIEW, Uri.parse(uri)); 3024 } 3025 3026 return intent; 3027 } 3028 3029 /** 3030 * Retrieve the general action to be performed, such as 3031 * {@link #ACTION_VIEW}. The action describes the general way the rest of 3032 * the information in the intent should be interpreted -- most importantly, 3033 * what to do with the data returned by {@link #getData}. 3034 * 3035 * @return The action of this intent or null if none is specified. 3036 * 3037 * @see #setAction 3038 */ 3039 public String getAction() { 3040 return mAction; 3041 } 3042 3043 /** 3044 * Retrieve data this intent is operating on. This URI specifies the name 3045 * of the data; often it uses the content: scheme, specifying data in a 3046 * content provider. Other schemes may be handled by specific activities, 3047 * such as http: by the web browser. 3048 * 3049 * @return The URI of the data this intent is targeting or null. 3050 * 3051 * @see #getScheme 3052 * @see #setData 3053 */ 3054 public Uri getData() { 3055 return mData; 3056 } 3057 3058 /** 3059 * The same as {@link #getData()}, but returns the URI as an encoded 3060 * String. 3061 */ 3062 public String getDataString() { 3063 return mData != null ? mData.toString() : null; 3064 } 3065 3066 /** 3067 * Return the scheme portion of the intent's data. If the data is null or 3068 * does not include a scheme, null is returned. Otherwise, the scheme 3069 * prefix without the final ':' is returned, i.e. "http". 3070 * 3071 * <p>This is the same as calling getData().getScheme() (and checking for 3072 * null data). 3073 * 3074 * @return The scheme of this intent. 3075 * 3076 * @see #getData 3077 */ 3078 public String getScheme() { 3079 return mData != null ? mData.getScheme() : null; 3080 } 3081 3082 /** 3083 * Retrieve any explicit MIME type included in the intent. This is usually 3084 * null, as the type is determined by the intent data. 3085 * 3086 * @return If a type was manually set, it is returned; else null is 3087 * returned. 3088 * 3089 * @see #resolveType(ContentResolver) 3090 * @see #setType 3091 */ 3092 public String getType() { 3093 return mType; 3094 } 3095 3096 /** 3097 * Return the MIME data type of this intent. If the type field is 3098 * explicitly set, that is simply returned. Otherwise, if the data is set, 3099 * the type of that data is returned. If neither fields are set, a null is 3100 * returned. 3101 * 3102 * @return The MIME type of this intent. 3103 * 3104 * @see #getType 3105 * @see #resolveType(ContentResolver) 3106 */ 3107 public String resolveType(Context context) { 3108 return resolveType(context.getContentResolver()); 3109 } 3110 3111 /** 3112 * Return the MIME data type of this intent. If the type field is 3113 * explicitly set, that is simply returned. Otherwise, if the data is set, 3114 * the type of that data is returned. If neither fields are set, a null is 3115 * returned. 3116 * 3117 * @param resolver A ContentResolver that can be used to determine the MIME 3118 * type of the intent's data. 3119 * 3120 * @return The MIME type of this intent. 3121 * 3122 * @see #getType 3123 * @see #resolveType(Context) 3124 */ 3125 public String resolveType(ContentResolver resolver) { 3126 if (mType != null) { 3127 return mType; 3128 } 3129 if (mData != null) { 3130 if ("content".equals(mData.getScheme())) { 3131 return resolver.getType(mData); 3132 } 3133 } 3134 return null; 3135 } 3136 3137 /** 3138 * Return the MIME data type of this intent, only if it will be needed for 3139 * intent resolution. This is not generally useful for application code; 3140 * it is used by the frameworks for communicating with back-end system 3141 * services. 3142 * 3143 * @param resolver A ContentResolver that can be used to determine the MIME 3144 * type of the intent's data. 3145 * 3146 * @return The MIME type of this intent, or null if it is unknown or not 3147 * needed. 3148 */ 3149 public String resolveTypeIfNeeded(ContentResolver resolver) { 3150 if (mComponent != null) { 3151 return mType; 3152 } 3153 return resolveType(resolver); 3154 } 3155 3156 /** 3157 * Check if an category exists in the intent. 3158 * 3159 * @param category The category to check. 3160 * 3161 * @return boolean True if the intent contains the category, else false. 3162 * 3163 * @see #getCategories 3164 * @see #addCategory 3165 */ 3166 public boolean hasCategory(String category) { 3167 return mCategories != null && mCategories.contains(category); 3168 } 3169 3170 /** 3171 * Return the set of all categories in the intent. If there are no categories, 3172 * returns NULL. 3173 * 3174 * @return Set The set of categories you can examine. Do not modify! 3175 * 3176 * @see #hasCategory 3177 * @see #addCategory 3178 */ 3179 public Set<String> getCategories() { 3180 return mCategories; 3181 } 3182 3183 /** 3184 * Sets the ClassLoader that will be used when unmarshalling 3185 * any Parcelable values from the extras of this Intent. 3186 * 3187 * @param loader a ClassLoader, or null to use the default loader 3188 * at the time of unmarshalling. 3189 */ 3190 public void setExtrasClassLoader(ClassLoader loader) { 3191 if (mExtras != null) { 3192 mExtras.setClassLoader(loader); 3193 } 3194 } 3195 3196 /** 3197 * Returns true if an extra value is associated with the given name. 3198 * @param name the extra's name 3199 * @return true if the given extra is present. 3200 */ 3201 public boolean hasExtra(String name) { 3202 return mExtras != null && mExtras.containsKey(name); 3203 } 3204 3205 /** 3206 * Returns true if the Intent's extras contain a parcelled file descriptor. 3207 * @return true if the Intent contains a parcelled file descriptor. 3208 */ 3209 public boolean hasFileDescriptors() { 3210 return mExtras != null && mExtras.hasFileDescriptors(); 3211 } 3212 3213 /** 3214 * Retrieve extended data from the intent. 3215 * 3216 * @param name The name of the desired item. 3217 * 3218 * @return the value of an item that previously added with putExtra() 3219 * or null if none was found. 3220 * 3221 * @deprecated 3222 * @hide 3223 */ 3224 @Deprecated 3225 public Object getExtra(String name) { 3226 return getExtra(name, null); 3227 } 3228 3229 /** 3230 * Retrieve extended data from the intent. 3231 * 3232 * @param name The name of the desired item. 3233 * @param defaultValue the value to be returned if no value of the desired 3234 * type is stored with the given name. 3235 * 3236 * @return the value of an item that previously added with putExtra() 3237 * or the default value if none was found. 3238 * 3239 * @see #putExtra(String, boolean) 3240 */ 3241 public boolean getBooleanExtra(String name, boolean defaultValue) { 3242 return mExtras == null ? defaultValue : 3243 mExtras.getBoolean(name, defaultValue); 3244 } 3245 3246 /** 3247 * Retrieve extended data from the intent. 3248 * 3249 * @param name The name of the desired item. 3250 * @param defaultValue the value to be returned if no value of the desired 3251 * type is stored with the given name. 3252 * 3253 * @return the value of an item that previously added with putExtra() 3254 * or the default value if none was found. 3255 * 3256 * @see #putExtra(String, byte) 3257 */ 3258 public byte getByteExtra(String name, byte defaultValue) { 3259 return mExtras == null ? defaultValue : 3260 mExtras.getByte(name, defaultValue); 3261 } 3262 3263 /** 3264 * Retrieve extended data from the intent. 3265 * 3266 * @param name The name of the desired item. 3267 * @param defaultValue the value to be returned if no value of the desired 3268 * type is stored with the given name. 3269 * 3270 * @return the value of an item that previously added with putExtra() 3271 * or the default value if none was found. 3272 * 3273 * @see #putExtra(String, short) 3274 */ 3275 public short getShortExtra(String name, short defaultValue) { 3276 return mExtras == null ? defaultValue : 3277 mExtras.getShort(name, defaultValue); 3278 } 3279 3280 /** 3281 * Retrieve extended data from the intent. 3282 * 3283 * @param name The name of the desired item. 3284 * @param defaultValue the value to be returned if no value of the desired 3285 * type is stored with the given name. 3286 * 3287 * @return the value of an item that previously added with putExtra() 3288 * or the default value if none was found. 3289 * 3290 * @see #putExtra(String, char) 3291 */ 3292 public char getCharExtra(String name, char defaultValue) { 3293 return mExtras == null ? defaultValue : 3294 mExtras.getChar(name, defaultValue); 3295 } 3296 3297 /** 3298 * Retrieve extended data from the intent. 3299 * 3300 * @param name The name of the desired item. 3301 * @param defaultValue the value to be returned if no value of the desired 3302 * type is stored with the given name. 3303 * 3304 * @return the value of an item that previously added with putExtra() 3305 * or the default value if none was found. 3306 * 3307 * @see #putExtra(String, int) 3308 */ 3309 public int getIntExtra(String name, int defaultValue) { 3310 return mExtras == null ? defaultValue : 3311 mExtras.getInt(name, defaultValue); 3312 } 3313 3314 /** 3315 * Retrieve extended data from the intent. 3316 * 3317 * @param name The name of the desired item. 3318 * @param defaultValue the value to be returned if no value of the desired 3319 * type is stored with the given name. 3320 * 3321 * @return the value of an item that previously added with putExtra() 3322 * or the default value if none was found. 3323 * 3324 * @see #putExtra(String, long) 3325 */ 3326 public long getLongExtra(String name, long defaultValue) { 3327 return mExtras == null ? defaultValue : 3328 mExtras.getLong(name, defaultValue); 3329 } 3330 3331 /** 3332 * Retrieve extended data from the intent. 3333 * 3334 * @param name The name of the desired item. 3335 * @param defaultValue the value to be returned if no value of the desired 3336 * type is stored with the given name. 3337 * 3338 * @return the value of an item that previously added with putExtra(), 3339 * or the default value if no such item is present 3340 * 3341 * @see #putExtra(String, float) 3342 */ 3343 public float getFloatExtra(String name, float defaultValue) { 3344 return mExtras == null ? defaultValue : 3345 mExtras.getFloat(name, defaultValue); 3346 } 3347 3348 /** 3349 * Retrieve extended data from the intent. 3350 * 3351 * @param name The name of the desired item. 3352 * @param defaultValue the value to be returned if no value of the desired 3353 * type is stored with the given name. 3354 * 3355 * @return the value of an item that previously added with putExtra() 3356 * or the default value if none was found. 3357 * 3358 * @see #putExtra(String, double) 3359 */ 3360 public double getDoubleExtra(String name, double defaultValue) { 3361 return mExtras == null ? defaultValue : 3362 mExtras.getDouble(name, defaultValue); 3363 } 3364 3365 /** 3366 * Retrieve extended data from the intent. 3367 * 3368 * @param name The name of the desired item. 3369 * 3370 * @return the value of an item that previously added with putExtra() 3371 * or null if no String value was found. 3372 * 3373 * @see #putExtra(String, String) 3374 */ 3375 public String getStringExtra(String name) { 3376 return mExtras == null ? null : mExtras.getString(name); 3377 } 3378 3379 /** 3380 * Retrieve extended data from the intent. 3381 * 3382 * @param name The name of the desired item. 3383 * 3384 * @return the value of an item that previously added with putExtra() 3385 * or null if no CharSequence value was found. 3386 * 3387 * @see #putExtra(String, CharSequence) 3388 */ 3389 public CharSequence getCharSequenceExtra(String name) { 3390 return mExtras == null ? null : mExtras.getCharSequence(name); 3391 } 3392 3393 /** 3394 * Retrieve extended data from the intent. 3395 * 3396 * @param name The name of the desired item. 3397 * 3398 * @return the value of an item that previously added with putExtra() 3399 * or null if no Parcelable value was found. 3400 * 3401 * @see #putExtra(String, Parcelable) 3402 */ 3403 public <T extends Parcelable> T getParcelableExtra(String name) { 3404 return mExtras == null ? null : mExtras.<T>getParcelable(name); 3405 } 3406 3407 /** 3408 * Retrieve extended data from the intent. 3409 * 3410 * @param name The name of the desired item. 3411 * 3412 * @return the value of an item that previously added with putExtra() 3413 * or null if no Parcelable[] value was found. 3414 * 3415 * @see #putExtra(String, Parcelable[]) 3416 */ 3417 public Parcelable[] getParcelableArrayExtra(String name) { 3418 return mExtras == null ? null : mExtras.getParcelableArray(name); 3419 } 3420 3421 /** 3422 * Retrieve extended data from the intent. 3423 * 3424 * @param name The name of the desired item. 3425 * 3426 * @return the value of an item that previously added with putExtra() 3427 * or null if no ArrayList<Parcelable> value was found. 3428 * 3429 * @see #putParcelableArrayListExtra(String, ArrayList) 3430 */ 3431 public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) { 3432 return mExtras == null ? null : mExtras.<T>getParcelableArrayList(name); 3433 } 3434 3435 /** 3436 * Retrieve extended data from the intent. 3437 * 3438 * @param name The name of the desired item. 3439 * 3440 * @return the value of an item that previously added with putExtra() 3441 * or null if no Serializable value was found. 3442 * 3443 * @see #putExtra(String, Serializable) 3444 */ 3445 public Serializable getSerializableExtra(String name) { 3446 return mExtras == null ? null : mExtras.getSerializable(name); 3447 } 3448 3449 /** 3450 * Retrieve extended data from the intent. 3451 * 3452 * @param name The name of the desired item. 3453 * 3454 * @return the value of an item that previously added with putExtra() 3455 * or null if no ArrayList<Integer> value was found. 3456 * 3457 * @see #putIntegerArrayListExtra(String, ArrayList) 3458 */ 3459 public ArrayList<Integer> getIntegerArrayListExtra(String name) { 3460 return mExtras == null ? null : mExtras.getIntegerArrayList(name); 3461 } 3462 3463 /** 3464 * Retrieve extended data from the intent. 3465 * 3466 * @param name The name of the desired item. 3467 * 3468 * @return the value of an item that previously added with putExtra() 3469 * or null if no ArrayList<String> value was found. 3470 * 3471 * @see #putStringArrayListExtra(String, ArrayList) 3472 */ 3473 public ArrayList<String> getStringArrayListExtra(String name) { 3474 return mExtras == null ? null : mExtras.getStringArrayList(name); 3475 } 3476 3477 /** 3478 * Retrieve extended data from the intent. 3479 * 3480 * @param name The name of the desired item. 3481 * 3482 * @return the value of an item that previously added with putExtra() 3483 * or null if no boolean array value was found. 3484 * 3485 * @see #putExtra(String, boolean[]) 3486 */ 3487 public boolean[] getBooleanArrayExtra(String name) { 3488 return mExtras == null ? null : mExtras.getBooleanArray(name); 3489 } 3490 3491 /** 3492 * Retrieve extended data from the intent. 3493 * 3494 * @param name The name of the desired item. 3495 * 3496 * @return the value of an item that previously added with putExtra() 3497 * or null if no byte array value was found. 3498 * 3499 * @see #putExtra(String, byte[]) 3500 */ 3501 public byte[] getByteArrayExtra(String name) { 3502 return mExtras == null ? null : mExtras.getByteArray(name); 3503 } 3504 3505 /** 3506 * Retrieve extended data from the intent. 3507 * 3508 * @param name The name of the desired item. 3509 * 3510 * @return the value of an item that previously added with putExtra() 3511 * or null if no short array value was found. 3512 * 3513 * @see #putExtra(String, short[]) 3514 */ 3515 public short[] getShortArrayExtra(String name) { 3516 return mExtras == null ? null : mExtras.getShortArray(name); 3517 } 3518 3519 /** 3520 * Retrieve extended data from the intent. 3521 * 3522 * @param name The name of the desired item. 3523 * 3524 * @return the value of an item that previously added with putExtra() 3525 * or null if no char array value was found. 3526 * 3527 * @see #putExtra(String, char[]) 3528 */ 3529 public char[] getCharArrayExtra(String name) { 3530 return mExtras == null ? null : mExtras.getCharArray(name); 3531 } 3532 3533 /** 3534 * Retrieve extended data from the intent. 3535 * 3536 * @param name The name of the desired item. 3537 * 3538 * @return the value of an item that previously added with putExtra() 3539 * or null if no int array value was found. 3540 * 3541 * @see #putExtra(String, int[]) 3542 */ 3543 public int[] getIntArrayExtra(String name) { 3544 return mExtras == null ? null : mExtras.getIntArray(name); 3545 } 3546 3547 /** 3548 * Retrieve extended data from the intent. 3549 * 3550 * @param name The name of the desired item. 3551 * 3552 * @return the value of an item that previously added with putExtra() 3553 * or null if no long array value was found. 3554 * 3555 * @see #putExtra(String, long[]) 3556 */ 3557 public long[] getLongArrayExtra(String name) { 3558 return mExtras == null ? null : mExtras.getLongArray(name); 3559 } 3560 3561 /** 3562 * Retrieve extended data from the intent. 3563 * 3564 * @param name The name of the desired item. 3565 * 3566 * @return the value of an item that previously added with putExtra() 3567 * or null if no float array value was found. 3568 * 3569 * @see #putExtra(String, float[]) 3570 */ 3571 public float[] getFloatArrayExtra(String name) { 3572 return mExtras == null ? null : mExtras.getFloatArray(name); 3573 } 3574 3575 /** 3576 * Retrieve extended data from the intent. 3577 * 3578 * @param name The name of the desired item. 3579 * 3580 * @return the value of an item that previously added with putExtra() 3581 * or null if no double array value was found. 3582 * 3583 * @see #putExtra(String, double[]) 3584 */ 3585 public double[] getDoubleArrayExtra(String name) { 3586 return mExtras == null ? null : mExtras.getDoubleArray(name); 3587 } 3588 3589 /** 3590 * Retrieve extended data from the intent. 3591 * 3592 * @param name The name of the desired item. 3593 * 3594 * @return the value of an item that previously added with putExtra() 3595 * or null if no String array value was found. 3596 * 3597 * @see #putExtra(String, String[]) 3598 */ 3599 public String[] getStringArrayExtra(String name) { 3600 return mExtras == null ? null : mExtras.getStringArray(name); 3601 } 3602 3603 /** 3604 * Retrieve extended data from the intent. 3605 * 3606 * @param name The name of the desired item. 3607 * 3608 * @return the value of an item that previously added with putExtra() 3609 * or null if no Bundle value was found. 3610 * 3611 * @see #putExtra(String, Bundle) 3612 */ 3613 public Bundle getBundleExtra(String name) { 3614 return mExtras == null ? null : mExtras.getBundle(name); 3615 } 3616 3617 /** 3618 * Retrieve extended data from the intent. 3619 * 3620 * @param name The name of the desired item. 3621 * 3622 * @return the value of an item that previously added with putExtra() 3623 * or null if no IBinder value was found. 3624 * 3625 * @see #putExtra(String, IBinder) 3626 * 3627 * @deprecated 3628 * @hide 3629 */ 3630 @Deprecated 3631 public IBinder getIBinderExtra(String name) { 3632 return mExtras == null ? null : mExtras.getIBinder(name); 3633 } 3634 3635 /** 3636 * Retrieve extended data from the intent. 3637 * 3638 * @param name The name of the desired item. 3639 * @param defaultValue The default value to return in case no item is 3640 * associated with the key 'name' 3641 * 3642 * @return the value of an item that previously added with putExtra() 3643 * or defaultValue if none was found. 3644 * 3645 * @see #putExtra 3646 * 3647 * @deprecated 3648 * @hide 3649 */ 3650 @Deprecated 3651 public Object getExtra(String name, Object defaultValue) { 3652 Object result = defaultValue; 3653 if (mExtras != null) { 3654 Object result2 = mExtras.get(name); 3655 if (result2 != null) { 3656 result = result2; 3657 } 3658 } 3659 3660 return result; 3661 } 3662 3663 /** 3664 * Retrieves a map of extended data from the intent. 3665 * 3666 * @return the map of all extras previously added with putExtra(), 3667 * or null if none have been added. 3668 */ 3669 public Bundle getExtras() { 3670 return (mExtras != null) 3671 ? new Bundle(mExtras) 3672 : null; 3673 } 3674 3675 /** 3676 * Retrieve any special flags associated with this intent. You will 3677 * normally just set them with {@link #setFlags} and let the system 3678 * take the appropriate action with them. 3679 * 3680 * @return int The currently set flags. 3681 * 3682 * @see #setFlags 3683 */ 3684 public int getFlags() { 3685 return mFlags; 3686 } 3687 3688 /** 3689 * Retrieve the application package name this Intent is limited to. When 3690 * resolving an Intent, if non-null this limits the resolution to only 3691 * components in the given application package. 3692 * 3693 * @return The name of the application package for the Intent. 3694 * 3695 * @see #resolveActivity 3696 * @see #setPackage 3697 */ 3698 public String getPackage() { 3699 return mPackage; 3700 } 3701 3702 /** 3703 * Retrieve the concrete component associated with the intent. When receiving 3704 * an intent, this is the component that was found to best handle it (that is, 3705 * yourself) and will always be non-null; in all other cases it will be 3706 * null unless explicitly set. 3707 * 3708 * @return The name of the application component to handle the intent. 3709 * 3710 * @see #resolveActivity 3711 * @see #setComponent 3712 */ 3713 public ComponentName getComponent() { 3714 return mComponent; 3715 } 3716 3717 /** 3718 * Get the bounds of the sender of this intent, in screen coordinates. This can be 3719 * used as a hint to the receiver for animations and the like. Null means that there 3720 * is no source bounds. 3721 */ 3722 public Rect getSourceBounds() { 3723 return mSourceBounds; 3724 } 3725 3726 /** 3727 * Return the Activity component that should be used to handle this intent. 3728 * The appropriate component is determined based on the information in the 3729 * intent, evaluated as follows: 3730 * 3731 * <p>If {@link #getComponent} returns an explicit class, that is returned 3732 * without any further consideration. 3733 * 3734 * <p>The activity must handle the {@link Intent#CATEGORY_DEFAULT} Intent 3735 * category to be considered. 3736 * 3737 * <p>If {@link #getAction} is non-NULL, the activity must handle this 3738 * action. 3739 * 3740 * <p>If {@link #resolveType} returns non-NULL, the activity must handle 3741 * this type. 3742 * 3743 * <p>If {@link #addCategory} has added any categories, the activity must 3744 * handle ALL of the categories specified. 3745 * 3746 * <p>If {@link #getPackage} is non-NULL, only activity components in 3747 * that application package will be considered. 3748 * 3749 * <p>If there are no activities that satisfy all of these conditions, a 3750 * null string is returned. 3751 * 3752 * <p>If multiple activities are found to satisfy the intent, the one with 3753 * the highest priority will be used. If there are multiple activities 3754 * with the same priority, the system will either pick the best activity 3755 * based on user preference, or resolve to a system class that will allow 3756 * the user to pick an activity and forward from there. 3757 * 3758 * <p>This method is implemented simply by calling 3759 * {@link PackageManager#resolveActivity} with the "defaultOnly" parameter 3760 * true.</p> 3761 * <p> This API is called for you as part of starting an activity from an 3762 * intent. You do not normally need to call it yourself.</p> 3763 * 3764 * @param pm The package manager with which to resolve the Intent. 3765 * 3766 * @return Name of the component implementing an activity that can 3767 * display the intent. 3768 * 3769 * @see #setComponent 3770 * @see #getComponent 3771 * @see #resolveActivityInfo 3772 */ 3773 public ComponentName resolveActivity(PackageManager pm) { 3774 if (mComponent != null) { 3775 return mComponent; 3776 } 3777 3778 ResolveInfo info = pm.resolveActivity( 3779 this, PackageManager.MATCH_DEFAULT_ONLY); 3780 if (info != null) { 3781 return new ComponentName( 3782 info.activityInfo.applicationInfo.packageName, 3783 info.activityInfo.name); 3784 } 3785 3786 return null; 3787 } 3788 3789 /** 3790 * Resolve the Intent into an {@link ActivityInfo} 3791 * describing the activity that should execute the intent. Resolution 3792 * follows the same rules as described for {@link #resolveActivity}, but 3793 * you get back the completely information about the resolved activity 3794 * instead of just its class name. 3795 * 3796 * @param pm The package manager with which to resolve the Intent. 3797 * @param flags Addition information to retrieve as per 3798 * {@link PackageManager#getActivityInfo(ComponentName, int) 3799 * PackageManager.getActivityInfo()}. 3800 * 3801 * @return PackageManager.ActivityInfo 3802 * 3803 * @see #resolveActivity 3804 */ 3805 public ActivityInfo resolveActivityInfo(PackageManager pm, int flags) { 3806 ActivityInfo ai = null; 3807 if (mComponent != null) { 3808 try { 3809 ai = pm.getActivityInfo(mComponent, flags); 3810 } catch (PackageManager.NameNotFoundException e) { 3811 // ignore 3812 } 3813 } else { 3814 ResolveInfo info = pm.resolveActivity( 3815 this, PackageManager.MATCH_DEFAULT_ONLY | flags); 3816 if (info != null) { 3817 ai = info.activityInfo; 3818 } 3819 } 3820 3821 return ai; 3822 } 3823 3824 /** 3825 * Set the general action to be performed. 3826 * 3827 * @param action An action name, such as ACTION_VIEW. Application-specific 3828 * actions should be prefixed with the vendor's package name. 3829 * 3830 * @return Returns the same Intent object, for chaining multiple calls 3831 * into a single statement. 3832 * 3833 * @see #getAction 3834 */ 3835 public Intent setAction(String action) { 3836 mAction = action; 3837 return this; 3838 } 3839 3840 /** 3841 * Set the data this intent is operating on. This method automatically 3842 * clears any type that was previously set by {@link #setType}. 3843 * 3844 * <p><em>Note: scheme and host name matching in the Android framework is 3845 * case-sensitive, unlike the formal RFC. As a result, 3846 * you should always ensure that you write your Uri with these elements 3847 * using lower case letters, and normalize any Uris you receive from 3848 * outside of Android to ensure the scheme and host is lower case.</em></p> 3849 * 3850 * @param data The URI of the data this intent is now targeting. 3851 * 3852 * @return Returns the same Intent object, for chaining multiple calls 3853 * into a single statement. 3854 * 3855 * @see #getData 3856 * @see #setType 3857 * @see #setDataAndType 3858 */ 3859 public Intent setData(Uri data) { 3860 mData = data; 3861 mType = null; 3862 return this; 3863 } 3864 3865 /** 3866 * Set an explicit MIME data type. This is used to create intents that 3867 * only specify a type and not data, for example to indicate the type of 3868 * data to return. This method automatically clears any data that was 3869 * previously set by {@link #setData}. 3870 * 3871 * <p><em>Note: MIME type matching in the Android framework is 3872 * case-sensitive, unlike formal RFC MIME types. As a result, 3873 * you should always write your MIME types with lower case letters, 3874 * and any MIME types you receive from outside of Android should be 3875 * converted to lower case before supplying them here.</em></p> 3876 * 3877 * @param type The MIME type of the data being handled by this intent. 3878 * 3879 * @return Returns the same Intent object, for chaining multiple calls 3880 * into a single statement. 3881 * 3882 * @see #getType 3883 * @see #setData 3884 * @see #setDataAndType 3885 */ 3886 public Intent setType(String type) { 3887 mData = null; 3888 mType = type; 3889 return this; 3890 } 3891 3892 /** 3893 * (Usually optional) Set the data for the intent along with an explicit 3894 * MIME data type. This method should very rarely be used -- it allows you 3895 * to override the MIME type that would ordinarily be inferred from the 3896 * data with your own type given here. 3897 * 3898 * <p><em>Note: MIME type, Uri scheme, and host name matching in the 3899 * Android framework is case-sensitive, unlike the formal RFC definitions. 3900 * As a result, you should always write these elements with lower case letters, 3901 * and normalize any MIME types or Uris you receive from 3902 * outside of Android to ensure these elements are lower case before 3903 * supplying them here.</em></p> 3904 * 3905 * @param data The URI of the data this intent is now targeting. 3906 * @param type The MIME type of the data being handled by this intent. 3907 * 3908 * @return Returns the same Intent object, for chaining multiple calls 3909 * into a single statement. 3910 * 3911 * @see #setData 3912 * @see #setType 3913 */ 3914 public Intent setDataAndType(Uri data, String type) { 3915 mData = data; 3916 mType = type; 3917 return this; 3918 } 3919 3920 /** 3921 * Add a new category to the intent. Categories provide additional detail 3922 * about the action the intent is perform. When resolving an intent, only 3923 * activities that provide <em>all</em> of the requested categories will be 3924 * used. 3925 * 3926 * @param category The desired category. This can be either one of the 3927 * predefined Intent categories, or a custom category in your own 3928 * namespace. 3929 * 3930 * @return Returns the same Intent object, for chaining multiple calls 3931 * into a single statement. 3932 * 3933 * @see #hasCategory 3934 * @see #removeCategory 3935 */ 3936 public Intent addCategory(String category) { 3937 if (mCategories == null) { 3938 mCategories = new HashSet<String>(); 3939 } 3940 mCategories.add(category); 3941 return this; 3942 } 3943 3944 /** 3945 * Remove an category from an intent. 3946 * 3947 * @param category The category to remove. 3948 * 3949 * @see #addCategory 3950 */ 3951 public void removeCategory(String category) { 3952 if (mCategories != null) { 3953 mCategories.remove(category); 3954 if (mCategories.size() == 0) { 3955 mCategories = null; 3956 } 3957 } 3958 } 3959 3960 /** 3961 * Add extended data to the intent. The name must include a package 3962 * prefix, for example the app com.android.contacts would use names 3963 * like "com.android.contacts.ShowAll". 3964 * 3965 * @param name The name of the extra data, with package prefix. 3966 * @param value The boolean data value. 3967 * 3968 * @return Returns the same Intent object, for chaining multiple calls 3969 * into a single statement. 3970 * 3971 * @see #putExtras 3972 * @see #removeExtra 3973 * @see #getBooleanExtra(String, boolean) 3974 */ 3975 public Intent putExtra(String name, boolean value) { 3976 if (mExtras == null) { 3977 mExtras = new Bundle(); 3978 } 3979 mExtras.putBoolean(name, value); 3980 return this; 3981 } 3982 3983 /** 3984 * Add extended data to the intent. The name must include a package 3985 * prefix, for example the app com.android.contacts would use names 3986 * like "com.android.contacts.ShowAll". 3987 * 3988 * @param name The name of the extra data, with package prefix. 3989 * @param value The byte data value. 3990 * 3991 * @return Returns the same Intent object, for chaining multiple calls 3992 * into a single statement. 3993 * 3994 * @see #putExtras 3995 * @see #removeExtra 3996 * @see #getByteExtra(String, byte) 3997 */ 3998 public Intent putExtra(String name, byte value) { 3999 if (mExtras == null) { 4000 mExtras = new Bundle(); 4001 } 4002 mExtras.putByte(name, value); 4003 return this; 4004 } 4005 4006 /** 4007 * Add extended data to the intent. The name must include a package 4008 * prefix, for example the app com.android.contacts would use names 4009 * like "com.android.contacts.ShowAll". 4010 * 4011 * @param name The name of the extra data, with package prefix. 4012 * @param value The char data value. 4013 * 4014 * @return Returns the same Intent object, for chaining multiple calls 4015 * into a single statement. 4016 * 4017 * @see #putExtras 4018 * @see #removeExtra 4019 * @see #getCharExtra(String, char) 4020 */ 4021 public Intent putExtra(String name, char value) { 4022 if (mExtras == null) { 4023 mExtras = new Bundle(); 4024 } 4025 mExtras.putChar(name, value); 4026 return this; 4027 } 4028 4029 /** 4030 * Add extended data to the intent. The name must include a package 4031 * prefix, for example the app com.android.contacts would use names 4032 * like "com.android.contacts.ShowAll". 4033 * 4034 * @param name The name of the extra data, with package prefix. 4035 * @param value The short data value. 4036 * 4037 * @return Returns the same Intent object, for chaining multiple calls 4038 * into a single statement. 4039 * 4040 * @see #putExtras 4041 * @see #removeExtra 4042 * @see #getShortExtra(String, short) 4043 */ 4044 public Intent putExtra(String name, short value) { 4045 if (mExtras == null) { 4046 mExtras = new Bundle(); 4047 } 4048 mExtras.putShort(name, value); 4049 return this; 4050 } 4051 4052 /** 4053 * Add extended data to the intent. The name must include a package 4054 * prefix, for example the app com.android.contacts would use names 4055 * like "com.android.contacts.ShowAll". 4056 * 4057 * @param name The name of the extra data, with package prefix. 4058 * @param value The integer data value. 4059 * 4060 * @return Returns the same Intent object, for chaining multiple calls 4061 * into a single statement. 4062 * 4063 * @see #putExtras 4064 * @see #removeExtra 4065 * @see #getIntExtra(String, int) 4066 */ 4067 public Intent putExtra(String name, int value) { 4068 if (mExtras == null) { 4069 mExtras = new Bundle(); 4070 } 4071 mExtras.putInt(name, value); 4072 return this; 4073 } 4074 4075 /** 4076 * Add extended data to the intent. The name must include a package 4077 * prefix, for example the app com.android.contacts would use names 4078 * like "com.android.contacts.ShowAll". 4079 * 4080 * @param name The name of the extra data, with package prefix. 4081 * @param value The long data value. 4082 * 4083 * @return Returns the same Intent object, for chaining multiple calls 4084 * into a single statement. 4085 * 4086 * @see #putExtras 4087 * @see #removeExtra 4088 * @see #getLongExtra(String, long) 4089 */ 4090 public Intent putExtra(String name, long value) { 4091 if (mExtras == null) { 4092 mExtras = new Bundle(); 4093 } 4094 mExtras.putLong(name, value); 4095 return this; 4096 } 4097 4098 /** 4099 * Add extended data to the intent. The name must include a package 4100 * prefix, for example the app com.android.contacts would use names 4101 * like "com.android.contacts.ShowAll". 4102 * 4103 * @param name The name of the extra data, with package prefix. 4104 * @param value The float data value. 4105 * 4106 * @return Returns the same Intent object, for chaining multiple calls 4107 * into a single statement. 4108 * 4109 * @see #putExtras 4110 * @see #removeExtra 4111 * @see #getFloatExtra(String, float) 4112 */ 4113 public Intent putExtra(String name, float value) { 4114 if (mExtras == null) { 4115 mExtras = new Bundle(); 4116 } 4117 mExtras.putFloat(name, value); 4118 return this; 4119 } 4120 4121 /** 4122 * Add extended data to the intent. The name must include a package 4123 * prefix, for example the app com.android.contacts would use names 4124 * like "com.android.contacts.ShowAll". 4125 * 4126 * @param name The name of the extra data, with package prefix. 4127 * @param value The double data value. 4128 * 4129 * @return Returns the same Intent object, for chaining multiple calls 4130 * into a single statement. 4131 * 4132 * @see #putExtras 4133 * @see #removeExtra 4134 * @see #getDoubleExtra(String, double) 4135 */ 4136 public Intent putExtra(String name, double value) { 4137 if (mExtras == null) { 4138 mExtras = new Bundle(); 4139 } 4140 mExtras.putDouble(name, value); 4141 return this; 4142 } 4143 4144 /** 4145 * Add extended data to the intent. The name must include a package 4146 * prefix, for example the app com.android.contacts would use names 4147 * like "com.android.contacts.ShowAll". 4148 * 4149 * @param name The name of the extra data, with package prefix. 4150 * @param value The String data value. 4151 * 4152 * @return Returns the same Intent object, for chaining multiple calls 4153 * into a single statement. 4154 * 4155 * @see #putExtras 4156 * @see #removeExtra 4157 * @see #getStringExtra(String) 4158 */ 4159 public Intent putExtra(String name, String value) { 4160 if (mExtras == null) { 4161 mExtras = new Bundle(); 4162 } 4163 mExtras.putString(name, value); 4164 return this; 4165 } 4166 4167 /** 4168 * Add extended data to the intent. The name must include a package 4169 * prefix, for example the app com.android.contacts would use names 4170 * like "com.android.contacts.ShowAll". 4171 * 4172 * @param name The name of the extra data, with package prefix. 4173 * @param value The CharSequence data value. 4174 * 4175 * @return Returns the same Intent object, for chaining multiple calls 4176 * into a single statement. 4177 * 4178 * @see #putExtras 4179 * @see #removeExtra 4180 * @see #getCharSequenceExtra(String) 4181 */ 4182 public Intent putExtra(String name, CharSequence value) { 4183 if (mExtras == null) { 4184 mExtras = new Bundle(); 4185 } 4186 mExtras.putCharSequence(name, value); 4187 return this; 4188 } 4189 4190 /** 4191 * Add extended data to the intent. The name must include a package 4192 * prefix, for example the app com.android.contacts would use names 4193 * like "com.android.contacts.ShowAll". 4194 * 4195 * @param name The name of the extra data, with package prefix. 4196 * @param value The Parcelable data value. 4197 * 4198 * @return Returns the same Intent object, for chaining multiple calls 4199 * into a single statement. 4200 * 4201 * @see #putExtras 4202 * @see #removeExtra 4203 * @see #getParcelableExtra(String) 4204 */ 4205 public Intent putExtra(String name, Parcelable value) { 4206 if (mExtras == null) { 4207 mExtras = new Bundle(); 4208 } 4209 mExtras.putParcelable(name, value); 4210 return this; 4211 } 4212 4213 /** 4214 * Add extended data to the intent. The name must include a package 4215 * prefix, for example the app com.android.contacts would use names 4216 * like "com.android.contacts.ShowAll". 4217 * 4218 * @param name The name of the extra data, with package prefix. 4219 * @param value The Parcelable[] data value. 4220 * 4221 * @return Returns the same Intent object, for chaining multiple calls 4222 * into a single statement. 4223 * 4224 * @see #putExtras 4225 * @see #removeExtra 4226 * @see #getParcelableArrayExtra(String) 4227 */ 4228 public Intent putExtra(String name, Parcelable[] value) { 4229 if (mExtras == null) { 4230 mExtras = new Bundle(); 4231 } 4232 mExtras.putParcelableArray(name, value); 4233 return this; 4234 } 4235 4236 /** 4237 * Add extended data to the intent. The name must include a package 4238 * prefix, for example the app com.android.contacts would use names 4239 * like "com.android.contacts.ShowAll". 4240 * 4241 * @param name The name of the extra data, with package prefix. 4242 * @param value The ArrayList<Parcelable> data value. 4243 * 4244 * @return Returns the same Intent object, for chaining multiple calls 4245 * into a single statement. 4246 * 4247 * @see #putExtras 4248 * @see #removeExtra 4249 * @see #getParcelableArrayListExtra(String) 4250 */ 4251 public Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value) { 4252 if (mExtras == null) { 4253 mExtras = new Bundle(); 4254 } 4255 mExtras.putParcelableArrayList(name, value); 4256 return this; 4257 } 4258 4259 /** 4260 * Add extended data to the intent. The name must include a package 4261 * prefix, for example the app com.android.contacts would use names 4262 * like "com.android.contacts.ShowAll". 4263 * 4264 * @param name The name of the extra data, with package prefix. 4265 * @param value The ArrayList<Integer> data value. 4266 * 4267 * @return Returns the same Intent object, for chaining multiple calls 4268 * into a single statement. 4269 * 4270 * @see #putExtras 4271 * @see #removeExtra 4272 * @see #getIntegerArrayListExtra(String) 4273 */ 4274 public Intent putIntegerArrayListExtra(String name, ArrayList<Integer> value) { 4275 if (mExtras == null) { 4276 mExtras = new Bundle(); 4277 } 4278 mExtras.putIntegerArrayList(name, value); 4279 return this; 4280 } 4281 4282 /** 4283 * Add extended data to the intent. The name must include a package 4284 * prefix, for example the app com.android.contacts would use names 4285 * like "com.android.contacts.ShowAll". 4286 * 4287 * @param name The name of the extra data, with package prefix. 4288 * @param value The ArrayList<String> data value. 4289 * 4290 * @return Returns the same Intent object, for chaining multiple calls 4291 * into a single statement. 4292 * 4293 * @see #putExtras 4294 * @see #removeExtra 4295 * @see #getStringArrayListExtra(String) 4296 */ 4297 public Intent putStringArrayListExtra(String name, ArrayList<String> value) { 4298 if (mExtras == null) { 4299 mExtras = new Bundle(); 4300 } 4301 mExtras.putStringArrayList(name, value); 4302 return this; 4303 } 4304 4305 /** 4306 * Add extended data to the intent. The name must include a package 4307 * prefix, for example the app com.android.contacts would use names 4308 * like "com.android.contacts.ShowAll". 4309 * 4310 * @param name The name of the extra data, with package prefix. 4311 * @param value The Serializable data value. 4312 * 4313 * @return Returns the same Intent object, for chaining multiple calls 4314 * into a single statement. 4315 * 4316 * @see #putExtras 4317 * @see #removeExtra 4318 * @see #getSerializableExtra(String) 4319 */ 4320 public Intent putExtra(String name, Serializable value) { 4321 if (mExtras == null) { 4322 mExtras = new Bundle(); 4323 } 4324 mExtras.putSerializable(name, value); 4325 return this; 4326 } 4327 4328 /** 4329 * Add extended data to the intent. The name must include a package 4330 * prefix, for example the app com.android.contacts would use names 4331 * like "com.android.contacts.ShowAll". 4332 * 4333 * @param name The name of the extra data, with package prefix. 4334 * @param value The boolean array data value. 4335 * 4336 * @return Returns the same Intent object, for chaining multiple calls 4337 * into a single statement. 4338 * 4339 * @see #putExtras 4340 * @see #removeExtra 4341 * @see #getBooleanArrayExtra(String) 4342 */ 4343 public Intent putExtra(String name, boolean[] value) { 4344 if (mExtras == null) { 4345 mExtras = new Bundle(); 4346 } 4347 mExtras.putBooleanArray(name, value); 4348 return this; 4349 } 4350 4351 /** 4352 * Add extended data to the intent. The name must include a package 4353 * prefix, for example the app com.android.contacts would use names 4354 * like "com.android.contacts.ShowAll". 4355 * 4356 * @param name The name of the extra data, with package prefix. 4357 * @param value The byte array data value. 4358 * 4359 * @return Returns the same Intent object, for chaining multiple calls 4360 * into a single statement. 4361 * 4362 * @see #putExtras 4363 * @see #removeExtra 4364 * @see #getByteArrayExtra(String) 4365 */ 4366 public Intent putExtra(String name, byte[] value) { 4367 if (mExtras == null) { 4368 mExtras = new Bundle(); 4369 } 4370 mExtras.putByteArray(name, value); 4371 return this; 4372 } 4373 4374 /** 4375 * Add extended data to the intent. The name must include a package 4376 * prefix, for example the app com.android.contacts would use names 4377 * like "com.android.contacts.ShowAll". 4378 * 4379 * @param name The name of the extra data, with package prefix. 4380 * @param value The short array data value. 4381 * 4382 * @return Returns the same Intent object, for chaining multiple calls 4383 * into a single statement. 4384 * 4385 * @see #putExtras 4386 * @see #removeExtra 4387 * @see #getShortArrayExtra(String) 4388 */ 4389 public Intent putExtra(String name, short[] value) { 4390 if (mExtras == null) { 4391 mExtras = new Bundle(); 4392 } 4393 mExtras.putShortArray(name, value); 4394 return this; 4395 } 4396 4397 /** 4398 * Add extended data to the intent. The name must include a package 4399 * prefix, for example the app com.android.contacts would use names 4400 * like "com.android.contacts.ShowAll". 4401 * 4402 * @param name The name of the extra data, with package prefix. 4403 * @param value The char array data value. 4404 * 4405 * @return Returns the same Intent object, for chaining multiple calls 4406 * into a single statement. 4407 * 4408 * @see #putExtras 4409 * @see #removeExtra 4410 * @see #getCharArrayExtra(String) 4411 */ 4412 public Intent putExtra(String name, char[] value) { 4413 if (mExtras == null) { 4414 mExtras = new Bundle(); 4415 } 4416 mExtras.putCharArray(name, value); 4417 return this; 4418 } 4419 4420 /** 4421 * Add extended data to the intent. The name must include a package 4422 * prefix, for example the app com.android.contacts would use names 4423 * like "com.android.contacts.ShowAll". 4424 * 4425 * @param name The name of the extra data, with package prefix. 4426 * @param value The int array data value. 4427 * 4428 * @return Returns the same Intent object, for chaining multiple calls 4429 * into a single statement. 4430 * 4431 * @see #putExtras 4432 * @see #removeExtra 4433 * @see #getIntArrayExtra(String) 4434 */ 4435 public Intent putExtra(String name, int[] value) { 4436 if (mExtras == null) { 4437 mExtras = new Bundle(); 4438 } 4439 mExtras.putIntArray(name, value); 4440 return this; 4441 } 4442 4443 /** 4444 * Add extended data to the intent. The name must include a package 4445 * prefix, for example the app com.android.contacts would use names 4446 * like "com.android.contacts.ShowAll". 4447 * 4448 * @param name The name of the extra data, with package prefix. 4449 * @param value The byte array data value. 4450 * 4451 * @return Returns the same Intent object, for chaining multiple calls 4452 * into a single statement. 4453 * 4454 * @see #putExtras 4455 * @see #removeExtra 4456 * @see #getLongArrayExtra(String) 4457 */ 4458 public Intent putExtra(String name, long[] value) { 4459 if (mExtras == null) { 4460 mExtras = new Bundle(); 4461 } 4462 mExtras.putLongArray(name, value); 4463 return this; 4464 } 4465 4466 /** 4467 * Add extended data to the intent. The name must include a package 4468 * prefix, for example the app com.android.contacts would use names 4469 * like "com.android.contacts.ShowAll". 4470 * 4471 * @param name The name of the extra data, with package prefix. 4472 * @param value The float array data value. 4473 * 4474 * @return Returns the same Intent object, for chaining multiple calls 4475 * into a single statement. 4476 * 4477 * @see #putExtras 4478 * @see #removeExtra 4479 * @see #getFloatArrayExtra(String) 4480 */ 4481 public Intent putExtra(String name, float[] value) { 4482 if (mExtras == null) { 4483 mExtras = new Bundle(); 4484 } 4485 mExtras.putFloatArray(name, value); 4486 return this; 4487 } 4488 4489 /** 4490 * Add extended data to the intent. The name must include a package 4491 * prefix, for example the app com.android.contacts would use names 4492 * like "com.android.contacts.ShowAll". 4493 * 4494 * @param name The name of the extra data, with package prefix. 4495 * @param value The double array data value. 4496 * 4497 * @return Returns the same Intent object, for chaining multiple calls 4498 * into a single statement. 4499 * 4500 * @see #putExtras 4501 * @see #removeExtra 4502 * @see #getDoubleArrayExtra(String) 4503 */ 4504 public Intent putExtra(String name, double[] value) { 4505 if (mExtras == null) { 4506 mExtras = new Bundle(); 4507 } 4508 mExtras.putDoubleArray(name, value); 4509 return this; 4510 } 4511 4512 /** 4513 * Add extended data to the intent. The name must include a package 4514 * prefix, for example the app com.android.contacts would use names 4515 * like "com.android.contacts.ShowAll". 4516 * 4517 * @param name The name of the extra data, with package prefix. 4518 * @param value The String array data value. 4519 * 4520 * @return Returns the same Intent object, for chaining multiple calls 4521 * into a single statement. 4522 * 4523 * @see #putExtras 4524 * @see #removeExtra 4525 * @see #getStringArrayExtra(String) 4526 */ 4527 public Intent putExtra(String name, String[] value) { 4528 if (mExtras == null) { 4529 mExtras = new Bundle(); 4530 } 4531 mExtras.putStringArray(name, value); 4532 return this; 4533 } 4534 4535 /** 4536 * Add extended data to the intent. The name must include a package 4537 * prefix, for example the app com.android.contacts would use names 4538 * like "com.android.contacts.ShowAll". 4539 * 4540 * @param name The name of the extra data, with package prefix. 4541 * @param value The Bundle data value. 4542 * 4543 * @return Returns the same Intent object, for chaining multiple calls 4544 * into a single statement. 4545 * 4546 * @see #putExtras 4547 * @see #removeExtra 4548 * @see #getBundleExtra(String) 4549 */ 4550 public Intent putExtra(String name, Bundle value) { 4551 if (mExtras == null) { 4552 mExtras = new Bundle(); 4553 } 4554 mExtras.putBundle(name, value); 4555 return this; 4556 } 4557 4558 /** 4559 * Add extended data to the intent. The name must include a package 4560 * prefix, for example the app com.android.contacts would use names 4561 * like "com.android.contacts.ShowAll". 4562 * 4563 * @param name The name of the extra data, with package prefix. 4564 * @param value The IBinder data value. 4565 * 4566 * @return Returns the same Intent object, for chaining multiple calls 4567 * into a single statement. 4568 * 4569 * @see #putExtras 4570 * @see #removeExtra 4571 * @see #getIBinderExtra(String) 4572 * 4573 * @deprecated 4574 * @hide 4575 */ 4576 @Deprecated 4577 public Intent putExtra(String name, IBinder value) { 4578 if (mExtras == null) { 4579 mExtras = new Bundle(); 4580 } 4581 mExtras.putIBinder(name, value); 4582 return this; 4583 } 4584 4585 /** 4586 * Copy all extras in 'src' in to this intent. 4587 * 4588 * @param src Contains the extras to copy. 4589 * 4590 * @see #putExtra 4591 */ 4592 public Intent putExtras(Intent src) { 4593 if (src.mExtras != null) { 4594 if (mExtras == null) { 4595 mExtras = new Bundle(src.mExtras); 4596 } else { 4597 mExtras.putAll(src.mExtras); 4598 } 4599 } 4600 return this; 4601 } 4602 4603 /** 4604 * Add a set of extended data to the intent. The keys must include a package 4605 * prefix, for example the app com.android.contacts would use names 4606 * like "com.android.contacts.ShowAll". 4607 * 4608 * @param extras The Bundle of extras to add to this intent. 4609 * 4610 * @see #putExtra 4611 * @see #removeExtra 4612 */ 4613 public Intent putExtras(Bundle extras) { 4614 if (mExtras == null) { 4615 mExtras = new Bundle(); 4616 } 4617 mExtras.putAll(extras); 4618 return this; 4619 } 4620 4621 /** 4622 * Completely replace the extras in the Intent with the extras in the 4623 * given Intent. 4624 * 4625 * @param src The exact extras contained in this Intent are copied 4626 * into the target intent, replacing any that were previously there. 4627 */ 4628 public Intent replaceExtras(Intent src) { 4629 mExtras = src.mExtras != null ? new Bundle(src.mExtras) : null; 4630 return this; 4631 } 4632 4633 /** 4634 * Completely replace the extras in the Intent with the given Bundle of 4635 * extras. 4636 * 4637 * @param extras The new set of extras in the Intent, or null to erase 4638 * all extras. 4639 */ 4640 public Intent replaceExtras(Bundle extras) { 4641 mExtras = extras != null ? new Bundle(extras) : null; 4642 return this; 4643 } 4644 4645 /** 4646 * Remove extended data from the intent. 4647 * 4648 * @see #putExtra 4649 */ 4650 public void removeExtra(String name) { 4651 if (mExtras != null) { 4652 mExtras.remove(name); 4653 if (mExtras.size() == 0) { 4654 mExtras = null; 4655 } 4656 } 4657 } 4658 4659 /** 4660 * Set special flags controlling how this intent is handled. Most values 4661 * here depend on the type of component being executed by the Intent, 4662 * specifically the FLAG_ACTIVITY_* flags are all for use with 4663 * {@link Context#startActivity Context.startActivity()} and the 4664 * FLAG_RECEIVER_* flags are all for use with 4665 * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}. 4666 * 4667 * <p>See the <a href="{@docRoot}guide/topics/fundamentals.html#acttask">Application Fundamentals: 4668 * Activities and Tasks</a> documentation for important information on how some of these options impact 4669 * the behavior of your application. 4670 * 4671 * @param flags The desired flags. 4672 * 4673 * @return Returns the same Intent object, for chaining multiple calls 4674 * into a single statement. 4675 * 4676 * @see #getFlags 4677 * @see #addFlags 4678 * 4679 * @see #FLAG_GRANT_READ_URI_PERMISSION 4680 * @see #FLAG_GRANT_WRITE_URI_PERMISSION 4681 * @see #FLAG_DEBUG_LOG_RESOLUTION 4682 * @see #FLAG_FROM_BACKGROUND 4683 * @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT 4684 * @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET 4685 * @see #FLAG_ACTIVITY_CLEAR_TOP 4686 * @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS 4687 * @see #FLAG_ACTIVITY_FORWARD_RESULT 4688 * @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY 4689 * @see #FLAG_ACTIVITY_MULTIPLE_TASK 4690 * @see #FLAG_ACTIVITY_NEW_TASK 4691 * @see #FLAG_ACTIVITY_NO_HISTORY 4692 * @see #FLAG_ACTIVITY_NO_USER_ACTION 4693 * @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP 4694 * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED 4695 * @see #FLAG_ACTIVITY_SINGLE_TOP 4696 * @see #FLAG_RECEIVER_REGISTERED_ONLY 4697 */ 4698 public Intent setFlags(int flags) { 4699 mFlags = flags; 4700 return this; 4701 } 4702 4703 /** 4704 * Add additional flags to the intent (or with existing flags 4705 * value). 4706 * 4707 * @param flags The new flags to set. 4708 * 4709 * @return Returns the same Intent object, for chaining multiple calls 4710 * into a single statement. 4711 * 4712 * @see #setFlags 4713 */ 4714 public Intent addFlags(int flags) { 4715 mFlags |= flags; 4716 return this; 4717 } 4718 4719 /** 4720 * (Usually optional) Set an explicit application package name that limits 4721 * the components this Intent will resolve to. If left to the default 4722 * value of null, all components in all applications will considered. 4723 * If non-null, the Intent can only match the components in the given 4724 * application package. 4725 * 4726 * @param packageName The name of the application package to handle the 4727 * intent, or null to allow any application package. 4728 * 4729 * @return Returns the same Intent object, for chaining multiple calls 4730 * into a single statement. 4731 * 4732 * @see #getPackage 4733 * @see #resolveActivity 4734 */ 4735 public Intent setPackage(String packageName) { 4736 mPackage = packageName; 4737 return this; 4738 } 4739 4740 /** 4741 * (Usually optional) Explicitly set the component to handle the intent. 4742 * If left with the default value of null, the system will determine the 4743 * appropriate class to use based on the other fields (action, data, 4744 * type, categories) in the Intent. If this class is defined, the 4745 * specified class will always be used regardless of the other fields. You 4746 * should only set this value when you know you absolutely want a specific 4747 * class to be used; otherwise it is better to let the system find the 4748 * appropriate class so that you will respect the installed applications 4749 * and user preferences. 4750 * 4751 * @param component The name of the application component to handle the 4752 * intent, or null to let the system find one for you. 4753 * 4754 * @return Returns the same Intent object, for chaining multiple calls 4755 * into a single statement. 4756 * 4757 * @see #setClass 4758 * @see #setClassName(Context, String) 4759 * @see #setClassName(String, String) 4760 * @see #getComponent 4761 * @see #resolveActivity 4762 */ 4763 public Intent setComponent(ComponentName component) { 4764 mComponent = component; 4765 return this; 4766 } 4767 4768 /** 4769 * Convenience for calling {@link #setComponent} with an 4770 * explicit class name. 4771 * 4772 * @param packageContext A Context of the application package implementing 4773 * this class. 4774 * @param className The name of a class inside of the application package 4775 * that will be used as the component for this Intent. 4776 * 4777 * @return Returns the same Intent object, for chaining multiple calls 4778 * into a single statement. 4779 * 4780 * @see #setComponent 4781 * @see #setClass 4782 */ 4783 public Intent setClassName(Context packageContext, String className) { 4784 mComponent = new ComponentName(packageContext, className); 4785 return this; 4786 } 4787 4788 /** 4789 * Convenience for calling {@link #setComponent} with an 4790 * explicit application package name and class name. 4791 * 4792 * @param packageName The name of the package implementing the desired 4793 * component. 4794 * @param className The name of a class inside of the application package 4795 * that will be used as the component for this Intent. 4796 * 4797 * @return Returns the same Intent object, for chaining multiple calls 4798 * into a single statement. 4799 * 4800 * @see #setComponent 4801 * @see #setClass 4802 */ 4803 public Intent setClassName(String packageName, String className) { 4804 mComponent = new ComponentName(packageName, className); 4805 return this; 4806 } 4807 4808 /** 4809 * Convenience for calling {@link #setComponent(ComponentName)} with the 4810 * name returned by a {@link Class} object. 4811 * 4812 * @param packageContext A Context of the application package implementing 4813 * this class. 4814 * @param cls The class name to set, equivalent to 4815 * <code>setClassName(context, cls.getName())</code>. 4816 * 4817 * @return Returns the same Intent object, for chaining multiple calls 4818 * into a single statement. 4819 * 4820 * @see #setComponent 4821 */ 4822 public Intent setClass(Context packageContext, Class<?> cls) { 4823 mComponent = new ComponentName(packageContext, cls); 4824 return this; 4825 } 4826 4827 /** 4828 * Set the bounds of the sender of this intent, in screen coordinates. This can be 4829 * used as a hint to the receiver for animations and the like. Null means that there 4830 * is no source bounds. 4831 */ 4832 public void setSourceBounds(Rect r) { 4833 if (r != null) { 4834 mSourceBounds = new Rect(r); 4835 } else { 4836 r = null; 4837 } 4838 } 4839 4840 /** 4841 * Use with {@link #fillIn} to allow the current action value to be 4842 * overwritten, even if it is already set. 4843 */ 4844 public static final int FILL_IN_ACTION = 1<<0; 4845 4846 /** 4847 * Use with {@link #fillIn} to allow the current data or type value 4848 * overwritten, even if it is already set. 4849 */ 4850 public static final int FILL_IN_DATA = 1<<1; 4851 4852 /** 4853 * Use with {@link #fillIn} to allow the current categories to be 4854 * overwritten, even if they are already set. 4855 */ 4856 public static final int FILL_IN_CATEGORIES = 1<<2; 4857 4858 /** 4859 * Use with {@link #fillIn} to allow the current component value to be 4860 * overwritten, even if it is already set. 4861 */ 4862 public static final int FILL_IN_COMPONENT = 1<<3; 4863 4864 /** 4865 * Use with {@link #fillIn} to allow the current package value to be 4866 * overwritten, even if it is already set. 4867 */ 4868 public static final int FILL_IN_PACKAGE = 1<<4; 4869 4870 /** 4871 * Use with {@link #fillIn} to allow the current package value to be 4872 * overwritten, even if it is already set. 4873 */ 4874 public static final int FILL_IN_SOURCE_BOUNDS = 1<<5; 4875 4876 /** 4877 * Copy the contents of <var>other</var> in to this object, but only 4878 * where fields are not defined by this object. For purposes of a field 4879 * being defined, the following pieces of data in the Intent are 4880 * considered to be separate fields: 4881 * 4882 * <ul> 4883 * <li> action, as set by {@link #setAction}. 4884 * <li> data URI and MIME type, as set by {@link #setData(Uri)}, 4885 * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}. 4886 * <li> categories, as set by {@link #addCategory}. 4887 * <li> package, as set by {@link #setPackage}. 4888 * <li> component, as set by {@link #setComponent(ComponentName)} or 4889 * related methods. 4890 * <li> source bounds, as set by {@link #setSourceBounds} 4891 * <li> each top-level name in the associated extras. 4892 * </ul> 4893 * 4894 * <p>In addition, you can use the {@link #FILL_IN_ACTION}, 4895 * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, 4896 * and {@link #FILL_IN_COMPONENT} to override the restriction where the 4897 * corresponding field will not be replaced if it is already set. 4898 * 4899 * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} is explicitly 4900 * specified. 4901 * 4902 * <p>For example, consider Intent A with {data="foo", categories="bar"} 4903 * and Intent B with {action="gotit", data-type="some/thing", 4904 * categories="one","two"}. 4905 * 4906 * <p>Calling A.fillIn(B, Intent.FILL_IN_DATA) will result in A now 4907 * containing: {action="gotit", data-type="some/thing", 4908 * categories="bar"}. 4909 * 4910 * @param other Another Intent whose values are to be used to fill in 4911 * the current one. 4912 * @param flags Options to control which fields can be filled in. 4913 * 4914 * @return Returns a bit mask of {@link #FILL_IN_ACTION}, 4915 * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, 4916 * and {@link #FILL_IN_COMPONENT} indicating which fields were changed. 4917 */ 4918 public int fillIn(Intent other, int flags) { 4919 int changes = 0; 4920 if (other.mAction != null 4921 && (mAction == null || (flags&FILL_IN_ACTION) != 0)) { 4922 mAction = other.mAction; 4923 changes |= FILL_IN_ACTION; 4924 } 4925 if ((other.mData != null || other.mType != null) 4926 && ((mData == null && mType == null) 4927 || (flags&FILL_IN_DATA) != 0)) { 4928 mData = other.mData; 4929 mType = other.mType; 4930 changes |= FILL_IN_DATA; 4931 } 4932 if (other.mCategories != null 4933 && (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) { 4934 if (other.mCategories != null) { 4935 mCategories = new HashSet<String>(other.mCategories); 4936 } 4937 changes |= FILL_IN_CATEGORIES; 4938 } 4939 if (other.mPackage != null 4940 && (mPackage == null || (flags&FILL_IN_PACKAGE) != 0)) { 4941 mPackage = other.mPackage; 4942 changes |= FILL_IN_PACKAGE; 4943 } 4944 // Component is special: it can -only- be set if explicitly allowed, 4945 // since otherwise the sender could force the intent somewhere the 4946 // originator didn't intend. 4947 if (other.mComponent != null && (flags&FILL_IN_COMPONENT) != 0) { 4948 mComponent = other.mComponent; 4949 changes |= FILL_IN_COMPONENT; 4950 } 4951 mFlags |= other.mFlags; 4952 if (other.mSourceBounds != null 4953 && (mSourceBounds == null || (flags&FILL_IN_SOURCE_BOUNDS) != 0)) { 4954 mSourceBounds = new Rect(other.mSourceBounds); 4955 changes |= FILL_IN_SOURCE_BOUNDS; 4956 } 4957 if (mExtras == null) { 4958 if (other.mExtras != null) { 4959 mExtras = new Bundle(other.mExtras); 4960 } 4961 } else if (other.mExtras != null) { 4962 try { 4963 Bundle newb = new Bundle(other.mExtras); 4964 newb.putAll(mExtras); 4965 mExtras = newb; 4966 } catch (RuntimeException e) { 4967 // Modifying the extras can cause us to unparcel the contents 4968 // of the bundle, and if we do this in the system process that 4969 // may fail. We really should handle this (i.e., the Bundle 4970 // impl shouldn't be on top of a plain map), but for now just 4971 // ignore it and keep the original contents. :( 4972 Log.w("Intent", "Failure filling in extras", e); 4973 } 4974 } 4975 return changes; 4976 } 4977 4978 /** 4979 * Wrapper class holding an Intent and implementing comparisons on it for 4980 * the purpose of filtering. The class implements its 4981 * {@link #equals equals()} and {@link #hashCode hashCode()} methods as 4982 * simple calls to {@link Intent#filterEquals(Intent)} filterEquals()} and 4983 * {@link android.content.Intent#filterHashCode()} filterHashCode()} 4984 * on the wrapped Intent. 4985 */ 4986 public static final class FilterComparison { 4987 private final Intent mIntent; 4988 private final int mHashCode; 4989 4990 public FilterComparison(Intent intent) { 4991 mIntent = intent; 4992 mHashCode = intent.filterHashCode(); 4993 } 4994 4995 /** 4996 * Return the Intent that this FilterComparison represents. 4997 * @return Returns the Intent held by the FilterComparison. Do 4998 * not modify! 4999 */ 5000 public Intent getIntent() { 5001 return mIntent; 5002 } 5003 5004 @Override 5005 public boolean equals(Object obj) { 5006 if (obj instanceof FilterComparison) { 5007 Intent other = ((FilterComparison)obj).mIntent; 5008 return mIntent.filterEquals(other); 5009 } 5010 return false; 5011 } 5012 5013 @Override 5014 public int hashCode() { 5015 return mHashCode; 5016 } 5017 } 5018 5019 /** 5020 * Determine if two intents are the same for the purposes of intent 5021 * resolution (filtering). That is, if their action, data, type, 5022 * class, and categories are the same. This does <em>not</em> compare 5023 * any extra data included in the intents. 5024 * 5025 * @param other The other Intent to compare against. 5026 * 5027 * @return Returns true if action, data, type, class, and categories 5028 * are the same. 5029 */ 5030 public boolean filterEquals(Intent other) { 5031 if (other == null) { 5032 return false; 5033 } 5034 if (mAction != other.mAction) { 5035 if (mAction != null) { 5036 if (!mAction.equals(other.mAction)) { 5037 return false; 5038 } 5039 } else { 5040 if (!other.mAction.equals(mAction)) { 5041 return false; 5042 } 5043 } 5044 } 5045 if (mData != other.mData) { 5046 if (mData != null) { 5047 if (!mData.equals(other.mData)) { 5048 return false; 5049 } 5050 } else { 5051 if (!other.mData.equals(mData)) { 5052 return false; 5053 } 5054 } 5055 } 5056 if (mType != other.mType) { 5057 if (mType != null) { 5058 if (!mType.equals(other.mType)) { 5059 return false; 5060 } 5061 } else { 5062 if (!other.mType.equals(mType)) { 5063 return false; 5064 } 5065 } 5066 } 5067 if (mPackage != other.mPackage) { 5068 if (mPackage != null) { 5069 if (!mPackage.equals(other.mPackage)) { 5070 return false; 5071 } 5072 } else { 5073 if (!other.mPackage.equals(mPackage)) { 5074 return false; 5075 } 5076 } 5077 } 5078 if (mComponent != other.mComponent) { 5079 if (mComponent != null) { 5080 if (!mComponent.equals(other.mComponent)) { 5081 return false; 5082 } 5083 } else { 5084 if (!other.mComponent.equals(mComponent)) { 5085 return false; 5086 } 5087 } 5088 } 5089 if (mCategories != other.mCategories) { 5090 if (mCategories != null) { 5091 if (!mCategories.equals(other.mCategories)) { 5092 return false; 5093 } 5094 } else { 5095 if (!other.mCategories.equals(mCategories)) { 5096 return false; 5097 } 5098 } 5099 } 5100 5101 return true; 5102 } 5103 5104 /** 5105 * Generate hash code that matches semantics of filterEquals(). 5106 * 5107 * @return Returns the hash value of the action, data, type, class, and 5108 * categories. 5109 * 5110 * @see #filterEquals 5111 */ 5112 public int filterHashCode() { 5113 int code = 0; 5114 if (mAction != null) { 5115 code += mAction.hashCode(); 5116 } 5117 if (mData != null) { 5118 code += mData.hashCode(); 5119 } 5120 if (mType != null) { 5121 code += mType.hashCode(); 5122 } 5123 if (mPackage != null) { 5124 code += mPackage.hashCode(); 5125 } 5126 if (mComponent != null) { 5127 code += mComponent.hashCode(); 5128 } 5129 if (mCategories != null) { 5130 code += mCategories.hashCode(); 5131 } 5132 return code; 5133 } 5134 5135 @Override 5136 public String toString() { 5137 StringBuilder b = new StringBuilder(128); 5138 5139 b.append("Intent { "); 5140 toShortString(b, true, true); 5141 b.append(" }"); 5142 5143 return b.toString(); 5144 } 5145 5146 /** @hide */ 5147 public String toShortString(boolean comp, boolean extras) { 5148 StringBuilder b = new StringBuilder(128); 5149 toShortString(b, comp, extras); 5150 return b.toString(); 5151 } 5152 5153 /** @hide */ 5154 public void toShortString(StringBuilder b, boolean comp, boolean extras) { 5155 boolean first = true; 5156 if (mAction != null) { 5157 b.append("act=").append(mAction); 5158 first = false; 5159 } 5160 if (mCategories != null) { 5161 if (!first) { 5162 b.append(' '); 5163 } 5164 first = false; 5165 b.append("cat=["); 5166 Iterator<String> i = mCategories.iterator(); 5167 boolean didone = false; 5168 while (i.hasNext()) { 5169 if (didone) b.append(","); 5170 didone = true; 5171 b.append(i.next()); 5172 } 5173 b.append("]"); 5174 } 5175 if (mData != null) { 5176 if (!first) { 5177 b.append(' '); 5178 } 5179 first = false; 5180 b.append("dat=").append(mData); 5181 } 5182 if (mType != null) { 5183 if (!first) { 5184 b.append(' '); 5185 } 5186 first = false; 5187 b.append("typ=").append(mType); 5188 } 5189 if (mFlags != 0) { 5190 if (!first) { 5191 b.append(' '); 5192 } 5193 first = false; 5194 b.append("flg=0x").append(Integer.toHexString(mFlags)); 5195 } 5196 if (mPackage != null) { 5197 if (!first) { 5198 b.append(' '); 5199 } 5200 first = false; 5201 b.append("pkg=").append(mPackage); 5202 } 5203 if (comp && mComponent != null) { 5204 if (!first) { 5205 b.append(' '); 5206 } 5207 first = false; 5208 b.append("cmp=").append(mComponent.flattenToShortString()); 5209 } 5210 if (mSourceBounds != null) { 5211 if (!first) { 5212 b.append(' '); 5213 } 5214 first = false; 5215 b.append("bnds=").append(mSourceBounds.toShortString()); 5216 } 5217 if (extras && mExtras != null) { 5218 if (!first) { 5219 b.append(' '); 5220 } 5221 first = false; 5222 b.append("(has extras)"); 5223 } 5224 } 5225 5226 /** 5227 * Call {@link #toUri} with 0 flags. 5228 * @deprecated Use {@link #toUri} instead. 5229 */ 5230 @Deprecated 5231 public String toURI() { 5232 return toUri(0); 5233 } 5234 5235 /** 5236 * Convert this Intent into a String holding a URI representation of it. 5237 * The returned URI string has been properly URI encoded, so it can be 5238 * used with {@link Uri#parse Uri.parse(String)}. The URI contains the 5239 * Intent's data as the base URI, with an additional fragment describing 5240 * the action, categories, type, flags, package, component, and extras. 5241 * 5242 * <p>You can convert the returned string back to an Intent with 5243 * {@link #getIntent}. 5244 * 5245 * @param flags Additional operating flags. Either 0 or 5246 * {@link #URI_INTENT_SCHEME}. 5247 * 5248 * @return Returns a URI encoding URI string describing the entire contents 5249 * of the Intent. 5250 */ 5251 public String toUri(int flags) { 5252 StringBuilder uri = new StringBuilder(128); 5253 String scheme = null; 5254 if (mData != null) { 5255 String data = mData.toString(); 5256 if ((flags&URI_INTENT_SCHEME) != 0) { 5257 final int N = data.length(); 5258 for (int i=0; i<N; i++) { 5259 char c = data.charAt(i); 5260 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') 5261 || c == '.' || c == '-') { 5262 continue; 5263 } 5264 if (c == ':' && i > 0) { 5265 // Valid scheme. 5266 scheme = data.substring(0, i); 5267 uri.append("intent:"); 5268 data = data.substring(i+1); 5269 break; 5270 } 5271 5272 // No scheme. 5273 break; 5274 } 5275 } 5276 uri.append(data); 5277 5278 } else if ((flags&URI_INTENT_SCHEME) != 0) { 5279 uri.append("intent:"); 5280 } 5281 5282 uri.append("#Intent;"); 5283 5284 if (scheme != null) { 5285 uri.append("scheme=").append(scheme).append(';'); 5286 } 5287 if (mAction != null) { 5288 uri.append("action=").append(Uri.encode(mAction)).append(';'); 5289 } 5290 if (mCategories != null) { 5291 for (String category : mCategories) { 5292 uri.append("category=").append(Uri.encode(category)).append(';'); 5293 } 5294 } 5295 if (mType != null) { 5296 uri.append("type=").append(Uri.encode(mType, "/")).append(';'); 5297 } 5298 if (mFlags != 0) { 5299 uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';'); 5300 } 5301 if (mPackage != null) { 5302 uri.append("package=").append(Uri.encode(mPackage)).append(';'); 5303 } 5304 if (mComponent != null) { 5305 uri.append("component=").append(Uri.encode( 5306 mComponent.flattenToShortString(), "/")).append(';'); 5307 } 5308 if (mSourceBounds != null) { 5309 uri.append("sourceBounds=") 5310 .append(Uri.encode(mSourceBounds.flattenToString())) 5311 .append(';'); 5312 } 5313 if (mExtras != null) { 5314 for (String key : mExtras.keySet()) { 5315 final Object value = mExtras.get(key); 5316 char entryType = 5317 value instanceof String ? 'S' : 5318 value instanceof Boolean ? 'B' : 5319 value instanceof Byte ? 'b' : 5320 value instanceof Character ? 'c' : 5321 value instanceof Double ? 'd' : 5322 value instanceof Float ? 'f' : 5323 value instanceof Integer ? 'i' : 5324 value instanceof Long ? 'l' : 5325 value instanceof Short ? 's' : 5326 '\0'; 5327 5328 if (entryType != '\0') { 5329 uri.append(entryType); 5330 uri.append('.'); 5331 uri.append(Uri.encode(key)); 5332 uri.append('='); 5333 uri.append(Uri.encode(value.toString())); 5334 uri.append(';'); 5335 } 5336 } 5337 } 5338 5339 uri.append("end"); 5340 5341 return uri.toString(); 5342 } 5343 5344 public int describeContents() { 5345 return (mExtras != null) ? mExtras.describeContents() : 0; 5346 } 5347 5348 public void writeToParcel(Parcel out, int flags) { 5349 out.writeString(mAction); 5350 Uri.writeToParcel(out, mData); 5351 out.writeString(mType); 5352 out.writeInt(mFlags); 5353 out.writeString(mPackage); 5354 ComponentName.writeToParcel(mComponent, out); 5355 5356 if (mSourceBounds != null) { 5357 out.writeInt(1); 5358 mSourceBounds.writeToParcel(out, flags); 5359 } else { 5360 out.writeInt(0); 5361 } 5362 5363 if (mCategories != null) { 5364 out.writeInt(mCategories.size()); 5365 for (String category : mCategories) { 5366 out.writeString(category); 5367 } 5368 } else { 5369 out.writeInt(0); 5370 } 5371 5372 out.writeBundle(mExtras); 5373 } 5374 5375 public static final Parcelable.Creator<Intent> CREATOR 5376 = new Parcelable.Creator<Intent>() { 5377 public Intent createFromParcel(Parcel in) { 5378 return new Intent(in); 5379 } 5380 public Intent[] newArray(int size) { 5381 return new Intent[size]; 5382 } 5383 }; 5384 5385 /** @hide */ 5386 protected Intent(Parcel in) { 5387 readFromParcel(in); 5388 } 5389 5390 public void readFromParcel(Parcel in) { 5391 mAction = in.readString(); 5392 mData = Uri.CREATOR.createFromParcel(in); 5393 mType = in.readString(); 5394 mFlags = in.readInt(); 5395 mPackage = in.readString(); 5396 mComponent = ComponentName.readFromParcel(in); 5397 5398 if (in.readInt() != 0) { 5399 mSourceBounds = Rect.CREATOR.createFromParcel(in); 5400 } 5401 5402 int N = in.readInt(); 5403 if (N > 0) { 5404 mCategories = new HashSet<String>(); 5405 int i; 5406 for (i=0; i<N; i++) { 5407 mCategories.add(in.readString()); 5408 } 5409 } else { 5410 mCategories = null; 5411 } 5412 5413 mExtras = in.readBundle(); 5414 } 5415 5416 /** 5417 * Parses the "intent" element (and its children) from XML and instantiates 5418 * an Intent object. The given XML parser should be located at the tag 5419 * where parsing should start (often named "intent"), from which the 5420 * basic action, data, type, and package and class name will be 5421 * retrieved. The function will then parse in to any child elements, 5422 * looking for <category android:name="xxx"> tags to add categories and 5423 * <extra android:name="xxx" android:value="yyy"> to attach extra data 5424 * to the intent. 5425 * 5426 * @param resources The Resources to use when inflating resources. 5427 * @param parser The XML parser pointing at an "intent" tag. 5428 * @param attrs The AttributeSet interface for retrieving extended 5429 * attribute data at the current <var>parser</var> location. 5430 * @return An Intent object matching the XML data. 5431 * @throws XmlPullParserException If there was an XML parsing error. 5432 * @throws IOException If there was an I/O error. 5433 */ 5434 public static Intent parseIntent(Resources resources, XmlPullParser parser, AttributeSet attrs) 5435 throws XmlPullParserException, IOException { 5436 Intent intent = new Intent(); 5437 5438 TypedArray sa = resources.obtainAttributes(attrs, 5439 com.android.internal.R.styleable.Intent); 5440 5441 intent.setAction(sa.getString(com.android.internal.R.styleable.Intent_action)); 5442 5443 String data = sa.getString(com.android.internal.R.styleable.Intent_data); 5444 String mimeType = sa.getString(com.android.internal.R.styleable.Intent_mimeType); 5445 intent.setDataAndType(data != null ? Uri.parse(data) : null, mimeType); 5446 5447 String packageName = sa.getString(com.android.internal.R.styleable.Intent_targetPackage); 5448 String className = sa.getString(com.android.internal.R.styleable.Intent_targetClass); 5449 if (packageName != null && className != null) { 5450 intent.setComponent(new ComponentName(packageName, className)); 5451 } 5452 5453 sa.recycle(); 5454 5455 int outerDepth = parser.getDepth(); 5456 int type; 5457 while ((type=parser.next()) != XmlPullParser.END_DOCUMENT 5458 && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) { 5459 if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { 5460 continue; 5461 } 5462 5463 String nodeName = parser.getName(); 5464 if (nodeName.equals("category")) { 5465 sa = resources.obtainAttributes(attrs, 5466 com.android.internal.R.styleable.IntentCategory); 5467 String cat = sa.getString(com.android.internal.R.styleable.IntentCategory_name); 5468 sa.recycle(); 5469 5470 if (cat != null) { 5471 intent.addCategory(cat); 5472 } 5473 XmlUtils.skipCurrentTag(parser); 5474 5475 } else if (nodeName.equals("extra")) { 5476 if (intent.mExtras == null) { 5477 intent.mExtras = new Bundle(); 5478 } 5479 resources.parseBundleExtra("extra", attrs, intent.mExtras); 5480 XmlUtils.skipCurrentTag(parser); 5481 5482 } else { 5483 XmlUtils.skipCurrentTag(parser); 5484 } 5485 } 5486 5487 return intent; 5488 } 5489} 5490