OSDN Git Service

Update doc for ACTION_HEADSET_PLUG to mention explicit register.
authorMatt Casey <mrcasey@google.com>
Wed, 26 Mar 2014 22:20:25 +0000 (15:20 -0700)
committerMatt Casey <mrcasey@google.com>
Wed, 26 Mar 2014 22:20:25 +0000 (15:20 -0700)
Copied the documentation from other similar actions that have the
same behavior.

AudioService.java has
 intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
for this action.

Change-Id: I79736f8146bd6b72d01034be428e83b5841c73fa

core/java/android/content/Intent.java

index 0175d62..102433b 100644 (file)
@@ -2173,6 +2173,11 @@ public class Intent implements Parcelable, Cloneable {
     /**
      * Broadcast Action: Wired Headset plugged in or unplugged.
      *
+     * You <em>cannot</em> receive this through components declared
+     * in manifests, only by explicitly registering for it with
+     * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
+     * Context.registerReceiver()}.
+     *
      * <p>The intent will have the following extra values:
      * <ul>
      *   <li><em>state</em> - 0 for unplugged, 1 for plugged. </li>