Vilen
Vilen

Reputation: 5061

Android 9 ResolvableApiException onActivityResult has resultCode 0 RESULT_CANCELED

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

Upvotes: 4

Views: 973

Answers (1)

adou600
adou600

Reputation: 301

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.

Upvotes: 1

Related Questions