如何知道哪些应用程序在后台运行
问题描述:
感谢以前的答复,如何知道哪些应用程序在后台运行
是否有可能知道哪些是背景process.My查询运行的是得到它在后台运行的应用程序列表中的应用。我搜索了一段时间,但仍然努力得到任何适当的解决方案。请指导我。
答
你可以使用这种代码运行的服务的列表:
private boolean isMyServiceRunning(Context context)
{
ActivityManager manager = (ActivityManager) context.getSystemService(Service.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))
{
if (service.service.getClassName().equals("myPackage.MySuperApplication"))
{
return true;
}
}
return false;
}
有一大堆的服务。类型,你可以检查,如果你想找到一个特定的,你使用它的完全限定的名称。
+0
感谢它获取所有后台应用程序。 – RAAAAM 2012-08-06 06:45:06
http://*.com/a/5801755/1075066.ApplicationManager的getRunningAppProcesses() – 2012-08-04 10:12:41