1. Android 4.0 in order to prevent some malware (malware) run in the background without user startup, the default installation of the program is completely ignored by the system before the user starts, even if the program registered the broadcast, the system will not pass the broadcast to the program. The message broadcast will not take effect until the program has been run by the user. Moreover, even if the program is already running, if the user forces stop (force stopped), it will return to the state ignored by the system.
In this case, a third-party app can receive broadcasts only in a running state (including activity in the background), and system applications are accepted under any circumstances.
2. The broadcast specifies the datatype, which is not specified in our registered Intent-filter.
By intent-filter the implicit start of a activity,service, the intent-filter of the recessive component must be written as follows:
"I am the component xxxx, I want to receive such an implicit event: its action must be XXX, its category must be YYYY, it contains the data must be zzzz"
If the component does not declare intentfilter, then all implicit events are not sent to the component. (Note that this does not affect sending an explicit event to the component.) )
This is why the simplest covert activation activity is intent-filter as follows:
<intent-filter><action android:name= "Com.android.action.NNN"/><category android:name= " Android.intent.category.DEFAULT "/></intent-filter>
Because the default intent has a default category value in addition to action.
When a photo is taken, the camera sends the following broadcast:
public static void Broadcastnewpicture (context context, Uri Uri) {context.sendbroadcast (new Intent (Action_new_picture, URI)); Context.sendbroadcast (New Intent ("Com.android.camera.NEW_PICTURE", Uri));}
To receive a broadcast you must write as follows:
<receiver android:name= "Com.android.gallery3d.vivo.NewPictureBroadcastReceiver" ><intent-filter>< Action android:name= "Android.hardware.action.NEW_PICTURE"/><data android:mimetype= "image/*"/></ Intent-filter><intent-filter><action android:name= "Com.android.camera.NEW_PICTURE"/><data Android:mimetype= "image/*"/></intent-filter> </receiver>
Reference: Add adddatascheme ("file") to receive the cause analysis of SD card Plug and Unplug event--an analysis of the Android event filtering strategy
Possible causes for Android not receiving broadcasts