Skip to content

Most visited

Recently visited

navigation

在运行时适当地请求权限(适用于 Android 6.0 及更高版本)

请确保在正确的时机提出权限请求,并适当地向用户说明和告知请求权限的需要。

这样做的好处

如果应用在提出权限请求时并未向用户充分说明权限用途(即不当权限请求),用户可能就不会同意授权,这可能会导致应用无法提供用户预期的功能。最糟糕的是,用户可能会因为权限请求过于突兀而对应用失去信任,甚至卸载应用。

只要依照下列最佳做法提出权限请求,用户就会相信应用请求权限具有正当的理由,并会谨慎处理允许访问的数据或功能。如此一来,用户就会比较愿意授予应用所需的权限,并且在顺利使用预期的应用功能后继续使用应用。

最佳做法

  • 向用户说明请求权限的原因(特别是针对权限用途不明确的情况):对于需要授予权限才能使用的功能,您应清楚地说明所请求的权限将用于提供什么好处。
  • 应用在尝试使用任何权限之前,一律应检查用户是否已授予该权限,因为用户可能会随时通过系统设置撤销权限。
  • 确保用户可在授予权限后立即获得好处,让他们能够信任应用,并告知权限请求的正当性和必要性。
  • 帮助用户撤消拒绝授权设置。如果用户已选择“不再询问”选项,您可以告诉他们如果日后想要授予权限,该如何转到应用设置

使用入门

请求权限
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.