Registration of broadcast 'a in the manifest ended with a file. specifically: I wanted to screw ACTION_HEADSET_PLUG into my manifest. screwed, filter prescribed, launched the program on your phone. I turn off / turn on the headphones on my phone and nothing happens. I went the other way and registered the broadcastReceiver as an inner class in my Activity . screwed the registerBroadcast method and it worked. Immediately there was a reaction to the headphones. On stackoverflow kind of like (and in English not really) I found info that not all Broadcast 's would work if they were bolted in a manifest and were advised to use Broadcasta registration in program code.

So:

  1. How to find out a specific list of which Intent.Action can be used in the manifest, and which ones are not?
  2. Maybe for all polls to use registration in the program code?
  • Maybe you should stop screwing and reading the documentation? developer.android.com/reference/android/content/… can also help habrahabr.ru/post/149875 - jimpanzer
  • @jimpanzer should not minus such questions - people ask for the case - Barmaley
  • In that link on Habré there is one comment, which says that some Intent.Action can not be registered in Manifest. Unfortunately in the documentation I did not find it. Whether ACTION_HEADSET_PLUG will work with the manifest or not is not written in the comments. That's why I ask: "What exactly Intent.Action specifically work with the manifest and which ones don't?" - arg

1 answer 1

For those intent ones that cannot be captured in manifest -e, the system hung the flag FLAG_RECEIVER_REGISTERED_ONLY . Usually these are such intent-s that don't make sense to catch if the program is not running. These are events about turning off the screen, switching the phone to sleep mode and the like. In your case - connect headphones. There is no list of such events, but you can search for some of them.
For example:

 ACTION_DREAMING_STARTED ACTION_DREAMING_STOPPED ACTION_SCREEN_ON ACTION_SCREEN_OFF ACTION_USB_ANLG_HEADSET_PLUG ACTION_USB_DGTL_HEADSET_PLUG ACTION_HDMI_AUDIO_PLUG ACTION_HEADSET_PLUG 

Output: it is logical to think that the OS could put the FLAG_RECEIVER_REGISTERED_ONLY flag on a specific intent.