4

I have this weird behavior on android 9 for location tracking. Basically when I turn off high accuracy location I get ResolvableApiException which is correct, but then if I call

resolvableApiException.startResolutionForResult(activity, REQUEST_CHECK_SETTINGS)

it shows a popup, which is also correct.

Problem is that if I press OK button onActivityResult called with resultCode = 0 which is not correct and it should be called with resultCode = -1 or what is the same resultCode = Activity.RESULT_OK

Note: this only happens on android 9, I tested it on Pixel 2, One Plus 6 and Nokia devices same behavior, and on older android versions it works correctly.

Another weird part is that, if OK button is clicked it changes accuracy settings but those settings are not applied to application and it gets same resolvableApiException again, unless I manually go to settings disable and enable high accuracy location mode.

enter image description here

Vilen
  • 5,061
  • 3
  • 28
  • 39
  • I think that the displayed popup refers to Google location permissions (you can find the relative option inside phone settings menu). Once your phone has these permissions, you still have to require user to have location permissions for the app itself, as a runtime permission. I really struggled with settings location permissions for my app, at the end I decided to use this third party library https://github.com/googlesamples/easypermissions – Nicola Gallazzi Dec 11 '18 at 14:32
  • @NicolaGallazzi This exception happens when app has location permission but doesn't have required location accuracy settings, for example if your app requires high accuracy but your settings are set to battery saving. Thanks for comment and link. – Vilen Dec 12 '18 at 06:17
  • I has the seem problem with api 27 but when i change to api 28 dont have problem, good luck – Dave Rincon Jul 05 '19 at 17:46

1 Answers1

1

I have the same problem! Note that for me it works when "Wi-Fi Scanning" is disabled, but it doesn't work with "Improve location accuracy" toggle.

adou600
  • 191
  • 2
  • 5