确定Android中已安装应用程序使用的权限列表

确定Android中已安装应用程序使用的权限列表,第1张

概述我必须确定我的设备上已安装的应用程序使用的权限列表.我已经安装了应用程序列表,并使用以下代码包名称:PackageManagerpm=this.getPackageManager();Intentintent=newIntent(Intent.ACTION_MAIN,null);intent.addCategory(Intent.CATEGORY_LAUNCHER);List<ResolveIn

我必须确定我的设备上已安装的应用程序使用的权限列表.

我已经安装了应用程序列表,并使用以下代码包名称:

PackageManager pm = this.getPackageManager();Intent intent = new Intent(Intent.ACTION_MAIN, null);intent.addcategory(Intent.category_LAUNCHER);List<ResolveInfo> List = m.queryIntentActivitIEs(intent,PackageManager.PERMISSION_GRANTED);  for (ResolveInfo rInfo : List) {      Log.d("Installed Applications", rInfo.activityInfo.applicationInfo     .loadLabel(pm).toString());   Log.d("packegename",rInfo.activityInfo.applicationInfo.packagename.           toString());     }

我如何获得每个应用程序使用的权限?

解决方法:

查看freetaskmanager

        // Loop through all installed packaged to get a List of used permissions and PackageInfos    for (PackageInfo pi : appList) {                    // Do not add System Packages        if ((pi.requestedPermissions == null || pi.packagename.equals("androID")) ||                 (pi.applicationInfo != null && (pi.applicationInfo.flags & ApplicationInfo.FLAG_SYstem) != 0))             continue;        for (String permission : pi.requestedPermissions) {            Map<String, String> curChildMap = new HashMap<String, String>();            try {                PermissionInfo pinfo = mPm.getPermissionInfo(permission, PackageManager.GET_Meta_DATA);                CharSequence label = pinfo.loadLabel(mPm);                CharSequence desc = pinfo.loadDescription(mPm);            } catch (nameNotFoundException e) {                Log.i(TAG, "Ignoring unkNown permission " + permission);                continue;            }        }    }
总结

以上是内存溢出为你收集整理的确定Android中已安装应用程序使用的权限列表全部内容,希望文章能够帮你解决确定Android中已安装应用程序使用的权限列表所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1116284.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存