权限请求应该简洁、透明、易懂。

Permission requests should be simple, transparent, and understandable.


用法

默认情况下,正常权限范围内的权限无需得到用户许可,系统默认赋予。

对于超出正常权限范围的权限,应用程序必须得到用户许可后才能获得。

Android apps have limited permissions associated with them by default. If your app selected to apply “normal” permissions, the system automatically grants those without user input.

For permissions that extend beyond the scope of normal permissions, the user must explicitly grant those permissions. These are classified according to the following groups.

权限分组

权限分为九个组,允许用户通过单个确认操作来赋予应用程序该组别下的所有权限。

例如,应用程序在向用户请求“提供查看、编辑和添加联系人”的权限时,将这些权限分组到单个权限组(称为“联系人”)比单独请求每个权限组更加方便。

Permissions are divided into nine groups, allowing users to grant all permissions encompassed by a single action by bundling them together as a group.

For example, to provide a user with permission to view, edit, and add Contacts, it’s more efficient to group these permissions into a single permission group (called Contacts) than to request each individually.

Permission Group Description
Calendar Managing calendars
Camera Taking photos and
recording videos
Contacts Managing contacts
Location Current device location
Microphone Audio recording
Phone Dialing and managing
phone calls
Body Sensors Heart rate and similar
data
SMS Sending and viewing
messages
Storage Accessing photos,
media, and files

用户行为分析

通过分析用户行为,系统可以不通过对话框来确认用户是否愿意提供权限,例如:

  • 拍照
  • 选择联系人
  • 开始通话或发短信

在这些情况下,用户的操作清楚地表明了他们的意图,应用程序不需要通过对话框来获取权限。

A user may perform an action that demonstrates clear intent, such as:

  • Taking a picture
  • Selecting a contact
  • Starting a call or text message

In these cases, the user’s action clearly demonstrates their intent, and no permission dialog is needed or authorized.


结构

image.png

  1. 权限组图标
  2. 应用名称
  3. 当用户连续两次拒绝提供权限时,显示“不再询问”的复选框
  4. 当用户需要处理多个对话框时,通过指示器告知用户处理进度
  5. 按钮

  6. Permission group icon

  7. App name
  8. “Never ask again” check box (This is displayed if a user denies a permission twice)
  9. Indicator for multiple dialogs
  10. Action

请求类型

如何向用户请求权限取决于权限类型的明确性与重要性。

  • 关键权限需要提前申请,避免影响应用的正常使用
  • 辅助权限可以在用户引导中或使用过程中申请

对于涉及敏感信息的权限或者用户可能无法理解的权限申请需要进行引导。

Your permissions strategy depends on the clarity and importance of the permission type you’re requesting. Each strategy offers a different way of introducing permissions to the user.

Critical permissions should be requested up-front.
Secondary permissions can be requested in context.

Permissions that are less clear should provide education about what the permission involves, whether done up-front or in context.

image.png
通过如图所示的坐标系,确定每个权限的清晰性和重要性级别。
Determine the clarity and importance level of each permission.

image.png

在请求权限之前进行引导

如果应用程序有新手引导,可以在引导中解释应用程序为何需要请求权限。
If your app has a “warm welcome,” use it to explain what your app does and why unexpected permissions will be requested.

事前申请

仅在首次启动时,请求关键的权限。

消息在传递时必须请求 SMS 权限,用户如果不允许该权限则无法正常使用。

Only ask for critical and obvious permissions on first launch.
Because users expect a messaging app to request SMS permissions, requesting it up-front makes sense.

image.png

运行中申请

在功能需要请求权限时,通过对话框询问用户。
当用户主动使用功能时,应用程序更容易获取权限。

Wait until a feature is invoked to request permission.
Users are more likely to allow a permission when they want to use the feature it enables.

情景引导

在用户使用程序时,通过解释说明,来告诉用户在允许权限后能获得哪些更优质的体验。

Explaining a permission in context helps gauge user interest and improve comprehension of the permission.

image.png

实时反馈

让用户允许权限时,能够马上获得正向反馈。

Provide instant gratification to make accepting a permission feel justified.

只请求部分权限

如果一项功能只需要一个组别下的部分权限,那么只请求这些权限。

When more than one permission is needed for a feature to work, only ask for those permissions and nothing else.


运行状态下的权限请求

应用程序可能会在首次启动时请求一些关键权限,之后在使用过程中,如果功能选项需要特定的权限,那么应用程序可能会请求许可。

用户可以随时在设置中关闭或开启相应权限的许可。

Apps may request permission to access information or use device capabilities at any time after installation. When a user needs to perform an action in an app, such as using the device camera, the app may request permission at that moment.

Users may also allow or deny the permissions of any app from Android Settings anytime after installation.
image.png
权限请求。


权限拒绝后的反馈提示

用户在拒绝权限后提供反馈提示。

如果被拒绝的权限会阻碍用户使用某项功能,那么在用户每次拒绝时应该进行说明。

拒绝权限的两种情况:

  • 用户主动拒绝
  • 用户在对话框中勾选了“不在询问”

为了保证用户正在使用的功能能够正常使用,应用程序需要提前申请权限并找到用户能够接受的方式。

Provide feedback whenever a permission is denied. Because denying permissions may prevent a feature from working as intended, whenever a permission is denied it should be explained to the user.

Permission denials occur in one of two ways:

  • A permission request is denied by the user
  • A permission is silently denied without warning because a user once selected “Don’t ask again” from a previous permission request

To ensure that features requiring permission always behave as intended, the app should state that permission is needed and provide a way to allow it.
image.png
底部的临时对话框显示用户需要提供权限许可来解锁音频功能。
A snackbar displays the need for permission in order to use an audio feature.

关键权限

如果关键权限被拒绝时,必须向用户解释为何需要这些权限,并且告知如何重新开启该项权限许可。

If the app can no longer run because a critical permission has been denied, explain why that permission must be allowed and offer a button to open Settings so the user can allow it.
image.png
通过新手引导告知用户为何需要提供关键权限的许可。
A screen explains that a permission is needed for an app to function, with a link to allow that permission in Settings.