Home > Blockchain >  how to hibernate or force stop apps without rooting..?
how to hibernate or force stop apps without rooting..?

Time:01-27

I know it is possible to send running android apps to hibernation on rooted device using adb command force-stop Target_PACKAGE how to do this on un-rooted device. Most of the people says it is not possible. But there is some apps like greefify, clean master or power Clean who does this using accessibility feature. How they works..? and how they use accessibility for this..?

CodePudding user response:

When you have an accessibility service it's easy to automatically press on buttons, use back button and so on. You can programmatically open the app details activity and press the force-stop button, it's quite simple.

CodePudding user response:

It is possible by using killBackgroundProcesses() method of ActivityManager:

ActivityManager activityanager = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
activityManager.killBackgroundProcesses(packageName);

But you need add the permission KILL_BACKGROUND_PROCESSES to the Manifest:

<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />

P.S.: warning - it is works for background processes only (that not displaying on screen).

  • Related