1

I have app where I'm using GoogleMaps. Normally if you run app for a first time or you will not allow location permission, it will show you dialog and warning message. But if I turn off location in my settings for every app on phone, it will check location permission and location permission was granted. Shouldn't this location permission turned off when I turn off global location in my settings?

Function checking if user has location permission:

val hasLocationPermission get() =
        ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
martin1337
  • 2,384
  • 6
  • 38
  • 85
  • Did you revoke the location permission for your app or did you just turn off the location setting? – Dennis Jul 31 '19 at 13:25
  • 2
    Permission doesn't mean location is on. It means you have the ability to use location. The location subsystem can still be off. If you didn't have permission, then even if location was on you wouldn't be able to get it. These are two separate concepts. – Gabe Sechan Jul 31 '19 at 13:25
  • And how to check in realtime if user turned off location? Because GoogleMap showed me some dialog window if I do that (not permission dialog). But I need inform user about it – martin1337 Jul 31 '19 at 13:31
  • I hope you will find this helpful https://stackoverflow.com/questions/2021176/how-can-i-check-the-current-status-of-the-gps-receiver – Bo Z Jul 31 '19 at 13:49
  • Look at this https://stackoverflow.com/questions/43138788/ask-user-to-turn-on-location – Davide Jun 15 '22 at 13:57

0 Answers0