enable and disable broadcast receiver on button click
- by Akhil
i want to enable and disable broadcast receiver programatically.. The receiver shouldn't respond until it is programatically turned on.. i did dee some similar questions but non of the answers worked.. please help...
i tried this code but didn't work..
PackageManager pm = getApplicationContext().getPackageManager();
ComponentName componentName = new ComponentName("mypackage",
".receivername");
pm.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);