是否可以通过电话设置授予“附近的API"权限? [英] Is it possible to grant Nearby API permissions from phone settings?

查看:117
本文介绍了是否可以通过电话设置授予“附近的API"权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

是否可以通过电话设置授予附近的API"权限?

  • 如果是,怎么办?
  • 答案是否随设备API级别而变化?

如有需要,请继续阅读以了解更多背景信息:)


一般背景

在运行API级别23或更高版本的设备上安装了针对API级别23或更高版本的应用程序时,用户可以通过两种不同的方式授予或撤消对需要危险权限的操作的访问:

  1. 当应用程序在前台运行时,在其中调用.据我所知,这些权限没有在任何标准的危险权限组中表示.

    就像典型的危险权限一样,用户可以指示应用程序不再询问"附近的API权限(例如,来自Pocket Casts;运行API 23的设备):

    但是,如果用户选择此选项,它将显得是永久的.在选中不再询问"后拒绝访问附近的API之后,以下是Pocket Casts列出的权限组:

    存在的唯一危险权限组是存储",并且仍然授予访问权限.没有附近API权限的迹象,因此,在达到此状态后,我看不到如何授予这些权限的访问权限...(除了卸载和重新安装该应用程序外,这并不理想!)

    编辑

    在最近的测试中,我似乎无法永久拒绝附近"许可.即使在第一次拒绝之后,也不会出现不再询问"复选框.我猜这是由于我的手机上运行的Google Play服务版本发生更改而引入的.这是权限对话框现在的样子.请注意,它包括有关查找附近权限设置的具体说明!

    解决方案

    作为一名开发人员,事后看来,这对我来说很有意义-这是将附近权限管理回传到棉花糖预装设备的唯一方法.但是,作为用户,我肯定会感到困惑!

    Question

    Is it possible to grant Nearby API permissions from phone settings?

    • If so, how?
    • Does the answer vary by device API level?

    Read on for more context if needed :)


    General Background

    When an app targeting API level 23 or higher is installed on a device running API level 23 or higher, access to actions that required dangerous permissions can be granted or revoked by the user in two different ways:

    1. while the application is running in the foreground, where calls to requestPermissions result in the user being shown a prompt;
    2. from the Settings -> Apps screen, where users can grant/revoke access to actions requiring dangerous permissions on a app-by-app or group-by-group basis.

    In particular, a user who has denied a permission that has been requested (at least) twice via mechanism #1, and who has checked 'Never ask again' in the most recently-displayed prompt:

    can still choose to grant that permission at a later time using mechanism #2.


    Nearby API Background

    When an app wishes to use the Nearby Messages API, a mechanism similar to (but distinct from) #1 can be used to request the necessary permissions at runtime. As far as I can tell, these permissions are not represented within any of the standard dangerous permissions groups.

    Just like for typical dangerous permissions, it is possible for a user to instruct an application to 'Never ask again' for the Nearby API permission (example from Pocket Casts; device running API 23):

    However, if a user selects this option it would appear to be totally permanent. Here are the listed permissions groups for Pocket Casts immediately after denying access to the Nearby APIs with 'Never ask again' checked:

    The only dangerous permissions group present is Storage, and access is still granted. There's no sign of the Nearby API permissions, and I therefore don't see how it is possible to ever grant access to these permissions after reaching this state... (apart from uninstalling and reinstalling the application, which isn't ideal!)

    Edit

    In more recent testing I seem unable to permanently deny the Nearby permission. Even after the first denial, the "Never ask again" checkbox does not appear. I am guessing this was introduced by a change in the Google Play Services version running on my phone. Here's what the permissions dialog looks like now. Note that it includes specific instructions related to locating the Nearby permission setting!

    解决方案

    As pointed out by Morrison Chang in the comments, Nearby API permissions control is located under Settings -> Google. Here's an animated gif showing how to grant access to the Nearby APIs on an app-by-app basis, starting from the settings screen of a Nexus 6 running Marshmallow:

    As a developer, this makes sense to me in hindsight - it's the only way Nearby permissions management could be backported to pre-Marshmallow devices. As a user, though, I definitely found this confusing!

    这篇关于是否可以通过电话设置授予“附近的API"权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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