Created
August 16, 2014 11:44
-
-
Save alorma/a593846127a2d3876572 to your computer and use it in GitHub Desktop.
Enable and disable component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int enabled = PackageManager.COMPONENT_ENABLED_STATE_ENABLED; | |
int disabled = PackageManager.COMPONENT_ENABLED_STATE_DISABLED; | |
ComponentName component = new ComponentName(context, | |
Interceptor.class); | |
context.getPackageManager().setComponentEnabledSetting(component, disabled, | |
PackageManager.DONT_KILL_APP); | |
context.startActivity(intent); | |
context.getPackageManager().setComponentEnabledSetting(component, enabled, | |
PackageManager.DONT_KILL_APP); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment