我必须确定我的设备上已安装的应用程序使用的权限列表.
我已经安装了应用程序列表,并使用以下代码包名称:
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中已安装应用程序使用的权限列表所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)