繁体   English   中英

返回没有系统应用程序的一组已安装应用程序

[英]Returning a set of installed applications without system apps

我想知道我需要编写什么代码才能返回一组非系统应用程序。

    public static List<?> getInstalledApplication(Context c) {
    return c.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);

}

这是返回所有内容的方法的代码。 我只想显示具有用户启动功能的应用程序。 我怎样才能做到这一点?

查看有关@Wand Maker的评论,以解决以下问题: 如何在Android中安装已安装的应用程序,而没有系统应用程序?

我认为您需要使用PackageManager找出所有支持意图过滤器的应用程序,这些应用程序具有动作“ android.intent.action.MAIN”和类别“ android.intent.category.LAUNCHER” – Wand Maker 7月6日15:23

您可以使用PackageManager.queryIntentActivities( http://developer.android.com/reference/android/content/pm/PackageManager.html#queryIntentActivities ( android.content.Intent ,int))来完成此操作

例如

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> activities = getPackageManager().queryIntentActivities(intent, 0);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM