android <permission,android中<permission-group>的用法是什么?

Declares a name for a logical grouping of related permissions. Individual

permission join the group through the permissionGroup attribute of the

element. Members of a group are presented together in the

user interface.

Note that this element does not declare a permission itself, only a category in

which permissions can be placed. See the element for element for

information on declaring permissions and assigning them to groups.

例如,消息相关的权限,说android.permission.SEND_SMS,RECEIVE_SMS和所有相关的消息下android.permission-group.MESSAGES分组权限有一个共同的图标。

android:label="@string/permgrouplab_messages"

android:icon="@drawable/perm_group_messages"

android:description="@string/permgroupdesc_messages"

android:permissionGroupFlags="personalInfo"

android:priority="360"/>

android:permissionGroup="android.permission-group.MESSAGES"

android:protectionLevel="dangerous"

android:label="@string/permlab_receiveSms"

android:description="@string/permdesc_receiveSms" />

android:permissionGroup="android.permission-group.MESSAGES"

android:protectionLevel="dangerous"

android:permissionFlags="costsMoney"

android:label="@string/permlab_sendSms"

android:description="@string/permdesc_sendSms" />

这里的AndroidManifest.xml中,将android.permission-group.MESSAGES categorises下的权限共同的图标和名称,这些权限在您的应用程序使用这些权限。

在一个示例应用程序看到的结果。这两个权限将被分组到一个共同的类别中。

b8aeb7a0bf238eca7fe1ae201912080f.png

成本钱是因为机器人的:permissionFlags =在SEND_SMS许可 “costsMoney”。因此,权限组仅用于对权限进行分类。它不能用于对一个或多个权限进行分组。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值