在发广播时加入Intent.FLAG_RECEIVER_REGISTERED_ONLY
Intent i=new Intent("spdif_cable_status");
i.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
context.sendBroadcast(i);
然后在AndroidMainfest.xml文件中注册
<receiver android:name=".SpdifReciver" android:enabled="true" >
<intent-filter>
<action android:name="spdif_cable_status" />
<category android:name="android.intent.category.default" />
</intent-filter>
</receiver>
结果收不到广播,这个是为什么,在AndroidMainfest.xml文件中注册不算注册吗
Intent i=new Intent("spdif_cable_status");
i.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
context.sendBroadcast(i);
然后在AndroidMainfest.xml文件中注册
<receiver android:name=".SpdifReciver" android:enabled="true" >
<intent-filter>
<action android:name="spdif_cable_status" />
<category android:name="android.intent.category.default" />
</intent-filter>
</receiver>
结果收不到广播,这个是为什么,在AndroidMainfest.xml文件中注册不算注册吗
解决方案 »
- Location of the Android SDK has not been set up in the preferences
- 请教onTouchEvent问题
- 关于文件写入
- 三星盖世s5660 求助!
- wifi的困惑
- android adb shell monkey
- 网络读取bitmap oom的问题
- eclipse 一启动 Genymotion 就卡死!!!!!!!!
- 自定义View调用onDraw方法
- java.lang.NoSuchMethodError: android.widget.DatePicker.callOnValueChange
- android 程序启动问题
- 请问怎么把javax.mail移植到android中
有没有办法使在AndroidMainfest.xml文件中注册的receiver能接收到这样的消息
Intent i=new Intent();
i.setAction("spdif_cable_status");
context.sendBroadcast(i);
试试