Skip to content

Instantly share code, notes, and snippets.

@pboos
Created November 7, 2012 22:31
Show Gist options
  • Save pboos/4034959 to your computer and use it in GitHub Desktop.
Save pboos/4034959 to your computer and use it in GitHub Desktop.
SleepTimer: Stop Services attempt without root [failed]
Class c = Class.forName("android.app.ActivityManagerNative");
Method getDefaultMethod = c.getMethod("getDefault");
getDefaultMethod.setAccessible(true);
Object nativeManager = getDefaultMethod.invoke(null);
c = nativeManager.getClass();
Method forceStopPackageMethod = c.getMethod("forceStopPackage", String.class);
forceStopPackageMethod.setAccessible(true);
forceStopPackageMethod.invoke(nativeManager, pkgName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment