1

I'm trying to be a good citizen and allow the user to change their location permission preference within the app after their original choice. The problem is that using this code:

ActivityCompat.requestPermissions(getActivity(), new String[]
       {Manifest.permission.ACCESS_FINE_LOCATION}, RESULT_APP_PERMISSIONS_CODE);

only works if the user has not allowed the permission. In other words, if they have allowed the FINE_LOCATION permission then no dialog shows and they cannot downgrade their choice to deny location permission without going to the system menu. Is it possible to re-request this location permission after it has been accepted?

Chris Knight
  • 24,333
  • 24
  • 88
  • 134

1 Answers1

1

You might look into just navigating them to the settings page for your app's permissions. Here's a link to a question that would answer how to navigate there:

How to programmatically open the Permission Screen for a specific app on Android Marshmallow?

vikvan
  • 11
  • 1
  • Thanks. I've ended up doing something similiar. But I'm unhappy with the experience of a user being presented with one dialog for accepting initial permissions and then being punted to an app setting's page where they have to click through to permissions. – Chris Knight Oct 10 '19 at 21:09
  • True, that would be frustrating. I'm sure you could create an activity that emulates the behavior of that settings page, where it shows the list of permissions with a toggle next to each one. – vikvan Oct 11 '19 at 18:32