Search code examples
google-nearby

Nearby permission requested multiple times


Is there a way for the user's acceptance of nearby permission to only be asked ONCE? I have an app where the permission is asked every few days (seemingly) when the app is opened.

I enable it with this code (also used to enable Google sign in):

 mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .addApi(Nearby.MESSAGES_API)
            .build();

Since nearby permission request is built into Neraby's auto management, that's the only code I was using. There's a chance that it's not actually asking for it multiple times and I'm just having a hard time separating the times it's asked after I've pushed code changes from times a few days have passed and it asks though. I've got it on multiple phones and it's a hobby project, so it's not a constant item I'm checking.


Solution

  • I haven't seen this happen on our devices (I work on the Nearby team at Google).

    The only case I know of where the dialog will reappear is if the app is uninstalled / reinstalled, or if the app loses its permissions in Settings > Google > Nearby > [gear icon].