对于Android 13运行时权限更改,每次安装可以显示系统对话框多少次?

huangapple go评论48阅读模式
英文:

For Android 13 runtime permission changes, how many times can I show the system dialog per installation?

问题

Android 新的运行时权限针对版本 13 提供了多少次可以调用系统对话框?即使有理由屏幕,我可以无限次调用它,还是每个用户都有限制?
将 SDK 升级到 33 并且操作系统运行在 13 上。

英文:

For the new runtime permissions Android has come up for version 13, how many times can I invoke the system dialog box? Even with the rationale screen, can I invoke it infinitely or is there a limit for every user?
Bumped up the SDK to 33 and OS running on 13.

答案1

得分: 1

根据我理解,这是适用于Android 11及以上版本的权限对话框可见性的一般规则:

从Android 11开始,如果用户在您的应用程序在设备上的安装生命周期内多次拒绝特定权限,再次请求该权限时,用户不会看到系统权限对话框。用户的操作暗示“不再询问”。在以前的版本中,除非用户之前选择了“不再询问”复选框或选项,否则用户会在每次应用程序请求权限时看到系统权限对话框。Android 11中的这种行为变更阻止了对已选择拒绝的权限进行重复请求。

https://developer.android.com/about/versions/11/privacy/permissions#dialog-visibility

基本上,按两次“拒绝”会使该权限被“永久拒绝”,从那时起,系统对话框不会显示,相反,您将立即获得isGranted = false的结果,表示该权限未被授予。

另外,我也在文档中找到类似以下的内容:

在某些情况下,权限可能会自动被拒绝,而无需用户采取任何操作。(权限也可以自动授予。)不要对自动行为做出任何假设非常重要。每当您的应用程序需要访问需要权限的功能时,请检查您的应用程序是否仍被授予该权限。

https://developer.android.com/training/permissions/requesting#handle-denial

我不太确定文档中提到的自动行为是指什么。我能想到的唯一一件事是,也许它指的是用户还可以在应用程序详细信息设置中授予/拒绝权限,而这是作为开发者你无法完全控制的事情。或者,也许它与上面提到的问题有关,即拒绝一个权限多次会自动使其“永久”拒绝,类似的情况。

英文:

In my understanding, this is the general rule that applies to permission dialog visibility for android 11 and above:

> Starting in Android 11, if the user taps Deny for a specific
> permission more than once during your app's lifetime of installation
> on a device, the user doesn't see the system permissions dialog if
> your app requests that permission again. The user's action implies
> "don't ask again." On previous versions, users would see the system
> permissions dialog each time your app requested a permission, unless
> the user had previously selected a "don't ask again" checkbox or
> option. This behavior change in Android 11 discourages repeated
> requests for permissions that users have chosen to deny.

https://developer.android.com/about/versions/11/privacy/permissions#dialog-visibility

Basically, pressing two times "deny", makes the permission "permanently denied", and, from then on, the system dialog doesn't show, rather, you will immediately get the result isGranted = false, for that permission.


On a side note, I could also find something like this in the documentation:

> In certain situations, the permission might be denied automatically,
> without the user taking any action. (A permission might be granted
> automatically as well.) It's important to not assume anything about
> automatic behavior. Each time your app needs to access functionality
> that requires a permission, check that your app is still granted that
> permission.

https://developer.android.com/training/permissions/requesting#handle-denial

I am not really sure what are those automatic behaviors that the documentation refers to. The only thing that comes to my mind is that maybe it's referring to the fact that the user can also grant/deny a permission from application details setting, and this is something that you as a developer won't have that much control over. Or, maybe it refers to thing from the top (your question), that denying a permission more than once - makes it automatically "permanently" denied, and similar.

答案2

得分: 0

没有严格的限制,但有一个选项,当拒绝权限时,可以勾选“不再询问”。在这种情况下,您将无法再次显示权限请求(对于给定的权限)。

当系统要求用户授予权限时,**用户可以选择告诉系统不再请求该权限。在这种情况下,每当应用程序使用requestPermissions()再次请求该权限时,系统立即拒绝请求。**系统会调用您的onRequestPermissionsResult()回调方法并传递PERMISSION_DENIED,就像用户明确拒绝了您的请求一样。这意味着当您调用requestPermissions()时,您不能假设已经与用户有直接互动。

英文:

There is no strict limit, but there is an option to check "Don't ask again" when denying permissions. In that case you will not be able to display permission requests again(for the given permission).

> When the system asks the user to grant a permission, the user has
> the option of telling the system not to ask for that permission again.
> In that case, any time an app uses requestPermissions() to ask for
> that permission again, the system immediately denies the request.

> The system calls your onRequestPermissionsResult() callback method and
> passes PERMISSION_DENIED, the same way it would if the user had
> explicitly rejected your request again. This means that when you call
> requestPermissions(), you cannot assume that any direct interaction
> with the user has taken place.

huangapple
  • 本文由 发表于 2023年2月6日 14:11:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357874.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定