Android动态封锁mainfest中的receiver

Android动态关闭mainfest中的receiverComponentName receiver new ComponentName(MainActivity.this,Boo

Android动态关闭mainfest中的receiver

ComponentName receiver = new ComponentName(MainActivity.this,BootReceiver.class);PackageManager pm = MainActivity.this.getPackageManager();pm.setComponentEnabledSetting(receiver,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP);

?状态有三个

不可用状态:COMPONENT_ENABLED_STATE_DISABLED

可用状态:COMPONENT_ENABLED_STATE_ENABLED

默认状态:COMPONENT_ENABLED_STATE_DEFAULT