[英]How to clear background processes in android?
I am working on a ram booster app and I need help with the code to clear inactive and background processes in android ? 我正在开发ram booster应用,我需要代码帮助来清除android中的非活动和后台进程?
I have tried this code but didn't make the job 我已经尝试过此代码,但没有完成工作
public void freeMemory(){
System.runFinalization();
Runtime.getRuntime().gc();
System.gc();
}
Use this code 使用此代码
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (RunningAppProcessInfo pid : am.getRunningAppProcesses()) {
am.killBackgroundProcesses(pid.processName);
}
You will be needing this permission 您将需要此权限
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
This is a open source task management application that could help you. 这是一个可以帮助您的开源任务管理应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.