从另一个活动禁用Broadcast Receiver类?

时间:2015-03-27 11:50:17

标签: android android-activity permissions sms broadcastreceiver

我有2项活动:1。BroadCastReceiver 2.设置。我在Settings活动中写了一个条件,一旦满足,应禁用BroadCastReceiver类,否则BroadCastReceiver类不能运行,直到我在Settings Activity中反转条件。但是问题是BroadCastReceiver类是通过Manifest文件调用的,我给它一个延迟:

android:name="android.provider.Telephony.SMS_RECEIVED"

现在,我无法弄清楚如何通过设置活动来禁用BroadCastReceiver类?

1 个答案:

答案 0 :(得分:0)

不要在Manifest文件中配置BroadcastReceiver。而是以编程方式注册和注销它。

查看this discussion.