2012-07-09 27 views
-7

可能重复:
How to get a list of installed android applications and pick one to run列出安装/ android系统中运行的应用程序编程

我们已经使用Android手机。

  1. 如何列出All Installed Applications
  2. 如何列出All Running Applications

帮帮我。谢谢。

+0

如何通过编程列出所有应用程序? – 2012-07-09 08:33:07

+0

检查这个职位的演示... http://whats-online.info/science-and-tutorials/42/Android-tutorial-list-installed-apps-package-name-programmatically/ ..它会帮助你 – 2016-11-13 04:53:13

回答

23

要获得安装在Android活动/应用程序的列表:How to get a list of installed android applications and pick one to run

要检查所有正在运行的应用程序

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

简称来源:

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); 
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); 
final List pkgAppsList = context.getPackageManager().queryIntentActivities(mainIntent, 0); 

从推介: http://www.dreamincode.net/forums/topic/138412-android-20-list-of-running-applications/

注意:以上描述的函数将返回以下API 21的正确结果,对于21以及更高版本,它已被弃用。

+0

谢谢。它列出了所有的应用程序。如何识别以编程方式列出当前正在运行的应用程序? – 2012-07-09 08:37:55

+0

检查编辑的代码 – Ponmalar 2012-07-09 08:45:46

+0

感谢Ponmalar。这对我和其他人有用。 – 2012-07-09 09:05:10

相关问题