Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enable and disable component
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