2012-05-29 204 views

回答

3

您应该使用getRunningAppProcesses()加载正在运行的应用程序列表并检查此列表中的变体。

看到这个link

另一种解决方案是分析logcat的输出

最先看到的答案this question

+0

是的,但我想它的时候正好运行新的运行的应用程序。我无法每次检查所有RunningAppProcesses。 –

+0

我提出这个: ActivityManager am =(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); \t \t \t \t \t \t列表 runningAppProcessInfo = am.getRunningAppProcesses(); \t \t \t 在我的服务,在onStartCommand。和我的应用程序被阻止(ANR)应用程序没有响应! –

+1

好的,在这种情况下,您应该尝试使用logcat并以正确的方式分析它的输出, 请参阅此链接的答案(http://stackoverflow.com/questions/3290936/android-detect-when-其他应用程序推出) – Silverstorm

相关问题