简体   繁体   English

如何在Android中过滤用户安装的应用程序?

[英]How to filter user installed application in Android?

I am creating a method to displays the installed applications in android. 我正在创建一种方法来显示android中已安装的应用程序。 I gave the following lines of code to get the application list 我提供了以下几行代码来获取应用程序列表

PackageManager packageManager=this.getPackageManager(); 
        List<PackageInfo> applist=packageManager.getInstalledPackages(0);
        Iterator<PackageInfo> it=applist.iterator();
        while(it.hasNext())
            {
                PackageInfo pk=(PackageInfo)it.next();
                    if(PackageManager.PERMISSION_GRANTED==packageManager.checkPermission(Manifest.permission.INTERNET, pk.packageName)) //checking if the package is having INTERNET permission
                        {
                            //some processing
                        }
            }
}

Here everything is working fine but the list includes the system packages too. 此处一切正常,但列表中也包括系统软件包。 I need to get only the list of user installed packages. 我只需要获取用户安装软件包的列表。 Is there any way to do?? 有什么办法吗?

What flag should we set in getInstalledPackages() to get the user installed packages? 我们应该在getInstalledPackages()中设置什么标志来获取用户安装的软件包?

如果已将ApplicationInfo对象安装在固件上,则它将具有FLAG_SYSTEM ,因此您可以使用它来过滤掉那些对象。

暂无
暂无

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

相关问题 如何从预定义的相机应用程序中筛选用户安装的相机应用程序 - How to filter the user installed camera application from predefined camera application 如何确定哪个用户安装了android应用程序? - How to determine which user installed the android application? 如何测试Facebook用户是否已使用sdk 3安装了我的android应用程序 - How to test if a Facebook user has installed my android application with sdk 3 Android-为什么Whatsapp不会被视为用户安装的应用程序? - Android - Why is Whatsapp not seen as a user installed application? 智能手机上安装的Android应用程序唯一用户ID - Android application unique User ID installed on smartphone 如何在Android上删除未安装的应用程序 - How to remove not installed application on Android 如何仅在 Android 上过滤已安装的游戏? - How to filter installed Games on Android only? Android / Google +如何知道用户的朋友是否安装了应用程序 - Android/Google+ How to know if user's friends have installed application 如果安装了应用程序或导航用户从 Web 应用程序播放商店,如何打开 Android 应用程序 - How to open android app if app is installed or navigate user to play store from web application 如何检测用户点击完成或在Android中的应用程序之后打开已经以编程方式安装 - how to detect if user clicked done or open after application in android has been installed programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM