检索权限列表 [英] Retrieve Permissions list

查看:97
本文介绍了检索权限列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找回我的设备的应用程序的权限。

I'm trying to retrieve the permissions of the apps in my device.

奇怪的是,对于一些应用程序我得到的结果,并在其中一些我无法检索到任何权限。

The weird thing is, for some apps I do get results, and in some of them I can't retrieve any permissions.

也许为了得到一个应用程序的权限列表,应用程序必须设置一些特定的标志?因为如果我试图让这样我的应用程序的权限列表:

Maybe in order to get the permissions list of an app, the app has to set some specific flag? Because if I try to get the permission list of my app in this way:

PackageManager p = context.getPackageManager();
PermissionInfo[] z=p.getPackageInfo("com.test.myapp",PackageManager.GET_PERMISSIONS).permissions);

以Z ,但对于一些应用程序(系统应用程序等。)我得到了一些列表

z is null, but for some apps (system apps, etc..) I do get some list.

你知道吗?

谢谢,moshik。

推荐答案

据我发现它时,PermissionInfo只包含非默认的权限(除android.Manifest.permission等。*)。

As far as i discovered it, the PermissionInfo contains only non-default permissions ( other than android.Manifest.permission.* ).

的唯一方法(我发现)是手动检查android.Manifest.permission。*通过

The only way ( i found ) is to manually check the android.Manifest.permission.* via

PackageManager.checkPermission(String permName, String pkgName); 

这篇关于检索权限列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆