Hi r/techsupport,
Long story short, I cannot listen to music or be on any phone calls while using my Android phone. The second I try to do anything else, like browse the web or open a different app, my call or music is suddenly killed. I've tried changing my battery settings and putting certain apps in "don't put to sleep" and have had no success. This is really aggravating when I'm on phone calls or want to listen to music while using my phone. Does anyone know how to definitively stop this?
Thanks!
Videos
Why do Android apps run in the background?
Apps running in the background is an essential feature in the Android ecosystem. This allows the phone to work backstage while you’re doing other things. You can keep a web page loading while you check Facebook, for example. As such, this allows for better multitasking.
Which background apps are known for being big battery hogs?
We can’t give you a definitive list of apps that drain your phone the most, but we can say that social media apps are common culprits. These might include Facebook, Messenger, Snapchat, and others. Of course, music and video streaming apps like Netflix, YouTube, and Spotify are other common culprits.
Are there any apps you should let run in the background, even if they drain the battery?
It all depends on which apps are important to you. If you rely on Facebook for work, for example, stopping it from running in the background isn’t a viable option. Additionally, stopping system apps from running in the background can affect performance and functionality.
I'd rather not touch the screen that often.
So instead of the needed swipes required to close each of them, it would be nice if I could just click on a single app that will do all that for me.
Hope this makes sense.
Cheers.
This will force-stop all applications including system-app
try
{
Process suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
os.writeBytes("adb shell" + "\n");
os.flush();
Context newContext=this;
ActivityManager activityManager = (ActivityManager) newContext.getSystemService( Context.ACTIVITY_SERVICE );
List<RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
for(RunningAppProcessInfo appProcess : appProcesses){
if(appProcess.processName.equals("com.yourPackageName")){
}
else{
os.writeBytes("am force-stop "+appProcess.processName + "\n");
}
}
os.flush();
os.close();
suProcess.waitFor();
}
catch (IOException ex)
{
ex.getMessage();
Toast.makeText(getApplicationContext(), ex.getMessage(),Toast.LENGTH_LONG).show();
}
catch (SecurityException ex)
{
Toast.makeText(getApplicationContext(), "Can't get root access2",
Toast.LENGTH_LONG).show();
}
catch (Exception ex)
{
Toast.makeText(getApplicationContext(), "Can't get root access3",
Toast.LENGTH_LONG).show();
}
I am pretty sure this is not possible, it would be bad practice for Android to allow apps to close other apps.
The answer is in this post: Kill another process/application programmatically
Please google your question before asking it here.