获取最近和运行的应用程序列表中未流程 [英] Get Recent and Running application list not processes

查看:171
本文介绍了获取最近和运行的应用程序列表中未流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了很多获得最新和运行应用程序(而不是过程)的列表中,但不能得到它。

I tried a lot to get the list of recent and running applications(not processes) but couldn't get it.

我在所有关于这一点,但我得到了有关正在运行的进程和近期任务的唯一答案的计算器问题又不是特殊应用就像我们可以在对home键长preSS三星手机任务管理器中看到的。

I went through all the stackoverflow questions regarding this but the only answer i got about the running processes and recent tasks not the application specific like we can see in Samsung Mobile task manager on long press of home button.

我能够通过这个code让正在运行的进程:

I am able to get the Running processes by this code :

ActivityManager actvityManager = (ActivityManager)
this.getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();

for(RunningAppProcessInfo runningProInfo:procInfos){

        Log.d("Running Processes", "()()"+runningProInfo.processName);
}

这是给所有进程的包名,但我想的应用程序,我已经推出(两者最近和正在运行)只有包名。

It is giving the package names of all processes but i want only the package names of applications that i have launched(Both Recent and Running).

我怎么能提取从运行的应用程序的进程?

How can I extract that from Running Application Processes?

推荐答案

更​​新:我不明白的方式,甚至通过使用下面的解决方案获得的最近的任务名称,但该会为当前运行和冷冻任务:<一href="http://developer.android.com/reference/android/app/ActivityManager.html#getRunningTasks%28int%29"相对=nofollow> getRunningTasks

UPDATE: I don't see a way to get the name of the recent tasks even by using the below solution but this will work for the currently running and frozen tasks: getRunningTasks

使用 getRunningTasks 返回 RunningTaskInfo 列表包含基组件名您可以使用通过调用来获取包的名字从 getPackageName()

Using getRunningTasks will return a list of RunningTaskInfo that contain the base ComponentName which you can use to get the package name from by calling getPackageName().

原来的答案:

您应该看看<一href="http://developer.android.com/reference/android/app/ActivityManager.html#getRecentTasks%28int,%20int%29"相对=nofollow> getRecentTasks 的。它的功能被描述为

You should look into getRecentTasks. Its function is described as

返回用户最近推出的任务列表,   最近的一次是后以第一和旧的。

Return a list of the tasks that the user has recently launched, with the most recent being first and older ones after in order.

请注意:此方法仅用于调试和presenting任务   管理用户界面。

Note: this method is only intended for debugging and presenting task management user interfaces.

这应该让你所有的最近运行或正在运行的应用程序的列表。

This should get you a list of all the apps that have recently run or are running.

这篇关于获取最近和运行的应用程序列表中未流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆