注意:给自己提个醒,轻易不用这种静态注册,否则做个啥操作,相关的都得整成静态的。没完没了··········一般情况动态注册。
将内部类改成static class,否则报错
- public class Service {
- public static class InsideService extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- Log.e("Service", "..onReceive..0914");
- }
- }
- }
在AndroidManifest.xml中定义
android:name="外部class$内部class",$连接
- <receiver android:name="com.jtd.service.Service$InsideService" >
- <intent-filter>
- <action android:name="com.jtd.service.Service.InsideService" />
- </intent-filter>
- </receiver>