[英]How to get recent active apps in android?
How we find recently running application.我们如何找到最近运行的应用程序。 I use this code but show only working app.
我使用此代码,但仅显示有效的应用程序。
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final List<RunningTaskInfo> recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE);
for (int i = 0; i < recentTasks.size(); i++)
{
Log.d("Executed app", "Application executed : "
+ recentTasks.get(i).baseActivity.toShortString()
+ "\t\t ID: "+recentTasks.get(i).id+"");
}
I found something in here which should help:我在这里找到了一些应该有帮助的东西:
https://gist.github.com/rmkrishna/7e133bcf1a918a02f2c882c1d7011b18 https://gist.github.com/rmkrishna/7e133bcf1a918a02f2c882c1d7011b18
First of all, it gets all recent apps.首先,它会获取所有最近的应用程序。
It has the Android Manifest
and Java
code.它具有
Android Manifest
和Java
代码。
I think it's fine to give you this since the contributor has been gone for several months now.我认为给你这个很好,因为贡献者已经离开几个月了。
I thought of giving you this link since I read in your comment that yours only shows working apps, if that above doesn't want to work...我想给你这个链接,因为我在你的评论中读到你的评论只显示工作应用程序,如果上面不想工作的话......
Tell me, I'll offer an alternative.告诉我,我会提供一个替代方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.