apache / cordova-plugin-geolocation

Apache Cordova Geolocation Plugin
https://cordova.apache.org/
Apache License 2.0
633 stars 657 forks source link

Infinite loop onPause() -> onResume() #277

Closed sergip76 closed 2 weeks ago

sergip76 commented 2 weeks ago

On Android, if the user rejects the location permission the application enters an infinite loop onPause() -> onResume(). This does not happen if the permission is accepted.

Platform: Android 12.0.1 Device: Android 13, API 33 Plugin version: 5.0.0 Cordova version: 12.0.0

breautek commented 2 weeks ago

Cannot reproduce using watchPosition or getCurrentPosition:

navigator.geolocation.watchPosition((e) => {
        console.log(e);
    }, (error) => {
        console.log(error);
    }, {
        enableHighAccuracy: true
    });

There will be a cycle of pause and resume events as the native dialog is presented that's normal. Your app will be paused when the native dialog is presented, and resumed when it's dismissed. It does not do an infinite loop using the code sample above.

Upon rejecting the permission I get the error event signaling a permission denied as expected. App becomes responsive.

The noted issue is likely occurring outside of this plugin. So closing as won't fix / not a bug.

If you still believe there is a bug within the geolocation plugin, then please fill out the issue form and provide a sample reproduction application.