注销广播接收器通过注册清单 [英] unregister broadcast receiver registered through manifest
本文介绍了注销广播接收器通过注册清单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以注销广播接收器
已通过舱单注册?
也请让我知道如果有可能忽略广播接收器
,未做任何code的变化,这个广播接收器
是没有用的,我现在。
谢谢你。
Is it possible to unregister a BroadcastReceiver
that has been registered through manifest?
Also please let me know if it possible to ignore the BroadcastReceiver
, without making any code changes, as this BroadcastReceiver
is of no use to me now.
Thanks.
推荐答案
您可以用这个code禁用接收器:
You can disable Receiver with this code:
PackageManager pm = getPackageManager();
ComponentName compName =
new ComponentName(getApplicationContext(),
MyReceiver.class);
pm.setComponentEnabledSetting(
compName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
您也可以使用 COMPONENT_ENABLED_STATE_ENABLED
,以使接收器。
这篇关于注销广播接收器通过注册清单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文