Often broadcast is written as an internal class of activity or service. At this time the registration and ordinary a little bit different.
There are two cases 1, if the manifest file inside the static registration, you need to pay attention to. Ex:<application android:icon= "@drawable/ic_launcher" android:label= "@string/app_name" Android:them E= "@style/apptheme" > <receiver android:name= ". Myactivity$myreceiver "> <intent-filter> <action android:name="Com.example.test.BROADCAST "/></intent-filter> </receiver> </application> One of the key points. Myactivity$myreceiver Note that the class name is separated from the name of the inner class by the $ symbol. second, the action inside the name Com.example.test.BROADCAST when the distribution of this, when the broadcast sent Intent Intent = new Intent ("Com.example.test.BROADCAST"); Intent.putextra ("Action", "Test"); Sendbroadcast (Intent);be consistent with the parameters inside the intent. Otherwise, the broadcast will not be accepted. Third, public static class Myreceiver extends Broadcastreceiver do not forget to define the receiver as public static, or start will error. 2, if the dynamic registration is generally written in oncreate or OnStart methods such as intentfilter filter = new Intentfilter (Com.example.test.BROADCAST);Registerreceiver (Broadcastreceiver, filter), dynamic registration must start the program to accept the broadcast, static registration even if the program does not start, you can also receive the broadcast.