Android 权限和权限组之间的链接 [英] Link between Android Permissions and Permission Groups

查看:27
本文介绍了Android 权限和权限组之间的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Android 开发的新手.我正在查看 android 清单权限.有两件事.权限和权限组.我知道

I an new to Android Development. I was looking at the android manifest permissions. There are two things. Permissions and Permission Groups. I know that the list at

http://developer.android.com/reference/android/Manifest.permission.html

并不全面,您也可以添加自己的权限.但是,我想问一下,是否可以将每个权限映射到

is not comprehensive and you can add your own permission as well.But, I want to ask that is this possible to map each permission into the permission groups mentioned at

http://developer.android.com/reference/android/Manifest.permission_group.html.

推荐答案

Android 源代码包含默认权限组和权限之间的实际映射.

The Android source contains the actual mappings between the default permission groups and permissions.

https://github.com/android/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml

如果您想要从权限组到权限的映射,您可以为您正在使用的 Android 版本获取 AndroidMainifest.xml 文件并解析 XML 以创建映射.所以回答你的问题是有可能的,但听起来这对你的任务来说可能有点过分.

If you wanted a mapping from permission group to permission you could take AndroidMainifest.xml file for the version of Android you are working with and parse the XML to create the mapping. So to answer your question yes it is possible, but it sounds like this may be overkill for your task.

更新:因为我自己实际上需要这个映射用于另一个项目,所以我决定共享我的代码来创建这个映射.可以在github仓库查看结果.

UPDATE: Because I actually needed this mapping myself for another project I decided to share my code to create this mapping. You can view the results in the github repository.

链接:https://github.com/benjholla/AndroidPermissionAttributeMapper

更新 2:

我的团队开源了我们的解决方案,该解决方案生成此映射以及围绕 Android 文档的其他一些对象包装器以获取权限.项目页面和github repo上有一些教程.

My group open sourced our solution that generates this mapping and some other object wrappers around Android documentation for permissions. There are some tutorials on the project page and the github repo.

项目页面:https://ensoftcorp.github.io/android-essentials-toolbox/

来源:https://github.com/EnSoftCorp/android-essentials-toolbox

这篇关于Android 权限和权限组之间的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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