5

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

stkent
  • 19,772
  • 14
  • 85
  • 111
  • Isn't Nearby API a Google Settings app permission and not a Android Settings permission? – Morrison Chang Apr 09 '16 at 00:46
  • I'm not sure I follow; how would I be able to tell the difference? – stkent Apr 09 '16 at 01:12
  • 1
    Your question relates to permission of the Nearby API. That API isn't native to Android (AOSP), its a Google Services API: https://developers.google.com/nearby/connections/android/get-started#initializing_your_google_api_client_for_nearby_connections I think you are under the belief that the permission screen you see is in the Android Settings app rather than the Google Settings app. Check your phone for the Google Settings app and look in 'Nearby'. – Morrison Chang Apr 09 '16 at 01:57
  • Ah, I see what you mean and I found the appropriate settings! I'll post a gif showing the procedure shortly. – stkent Apr 09 '16 at 02:30
  • 2
    The omission of the "Never ask again" checkbox is a bug that will be rectified in a future release. – Brian Duff Aug 17 '16 at 07:55

1 Answers1

5

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!

Community
  • 1
  • 1
stkent
  • 19,772
  • 14
  • 85
  • 111
  • 4
    We hear ya! Yep - it's a compromise in order to make this backportable to pre-M. – Brian Duff Jun 09 '16 at 20:00
  • @BrianDuff thanks for confirming - IMO it's much less of a big deal now that the permissions flow has changed to no longer include a 'don't ask again' option (at least, I believe that's true) :) – stkent Jun 10 '16 at 11:11
  • has the name / location of the Nearby changed recently? I can't seem to find this under Google anymore :( (related Q: https://stackoverflow.com/questions/60236243/how-to-revoke-google-nearby-permissions-for-an-app) – Bootstrapper Feb 15 '20 at 06:49
  • No idea; I checked and I also don't see that option any more :/ – stkent Feb 15 '20 at 21:31
  • That option no longer exists :( – Trọng Vĩnh Nguyễn Nov 18 '20 at 02:49