capacitor-community / background-geolocation

A Capacitor plugin that sends you geolocation updates, even while the app is in the background.
MIT License
177 stars 54 forks source link

requestPermissions true failed to register callback #79

Closed aeinn closed 1 year ago

aeinn commented 1 year ago

Describe the bug while experimenting with the watcher where requestPermissions is set true, once the user select "allow while using the app" on the permission prompt, a watcher ID will be returned but the callback does not get attached to the watcher/ did not get called by the watcher On the other hand, selecting don't allow will properly trigger the callback error of the watcher

Screenshots screenshots of the requestPermissions prompt Screenshot_20221018-111829_Permission controller

Smartphone

diachedelic commented 1 year ago

What version of Android are you using?

diachedelic commented 1 year ago

I have not been able to reproduce this problem on my Samsung running OneUI 4.1 (Android 12). Sometimes it takes a while for the callback to be called with the first location, but it does get called eventually. In your screenshot, you have the "Approximate" permission selected yet this plugin calls for the "Precise" permission.

I have fixed a bug whereby the stale parameter would be ignored if permissions were not yet granted, this has been released in v1.2.5. I also tweaked a couple of other things, so you can try it and see if it fixes your issue.

aeinn commented 1 year ago

Thanks for your response. I may have overlooked the "Precise" permission requirement on the previous version, but after updating to 1.2.5, the requestPermissions now returns error callback(intended?) if "Approximate" permission is selected.

But I have changed permission to "Precise" permission to prevent future error

diachedelic commented 1 year ago

Well, at least it doesn't fail silently. We should support Approximate permission though.