Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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):

A screenshot from Pocket Casts showing the Nearby API permissions prompt; 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:

A screenshot from system settings showing the App permissions screen for Pocket Casts; device running API 23

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!

A screenshot from Pocket Casts showing the updated Nearby API permissions prompt; device running API 23 and Google Play Services 9.0.83

like image 388
stkent Avatar asked Apr 09 '16 00:04

stkent


People also ask

How do I grant permissions API?

Right-click the individual API or Service to grant permissions. At the upper right of the API Permissions screen, click the Grant Permission icon or the Revoke Permission icon to grant or revoke permission to the user for that API or Service. By default, permission is revoked for all APIs or Services.

What is nearby device permission for?

Permission is part of the nearby devices group In system settings, the user must enable and disable the Nearby devices permissions as a group; for example, users can't disable Wi-Fi access but keep Bluetooth access enabled for a given app.


1 Answers

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:

An animated gif showing how to grant access to the Nearby APIs 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!

like image 170
stkent Avatar answered Sep 24 '22 20:09

stkent