如何从 arr 文件中获取后台进程 ID 并终止 android 中的进程
how to get the background process id from arr file and kill the process in android
我正在使用 3 方 sdk 和 运行 后台服务。
com.other.sdk.connection.starttheservice(context);
但我无法终止该后台服务。
可以使用ActivityManager的killBackgroundProcesses()方法:
ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
am.killBackgroundProcesses(packageName);
或
Process.killProcess(Process.myPid());
我正在使用 3 方 sdk 和 运行 后台服务。
com.other.sdk.connection.starttheservice(context);
但我无法终止该后台服务。
可以使用ActivityManager的killBackgroundProcesses()方法:
ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
am.killBackgroundProcesses(packageName);
或
Process.killProcess(Process.myPid());