Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geolocation not returning cached value on native app #609

Closed
gggiiia opened this issue Jul 20, 2020 · 3 comments · Fixed by #639
Closed

Geolocation not returning cached value on native app #609

gggiiia opened this issue Jul 20, 2020 · 3 comments · Fixed by #639

Comments

@gggiiia
Copy link

gggiiia commented Jul 20, 2020

Bug Report

Capacitor Version

2.3.0

Platform(s)

android

Current Behavior

calling Geolocation.getCurrentPosition() uses the hardware gps to get the position even if inside the cache time frame

Expected Behavior

return cached value to the promise if inside the defined cache time, right now the function is really slow since it always fetch the position from scrach

Code Reproduction

async () => {
      //using ms library to compose timestamps
      let options = { maximumAge: ms('5m'), timeout: ms('45s'), enableHighAccuracy: true };
      let pos = await Geolocation.getCurrentPosition(options);
      let pos2 = await Geolocation.getCurrentPosition(options);
}

Other Technical Details

npm --version output: 6.14.4

node --version output: v12.16.3

pod --version output (iOS issues only):

Additional Context

@gggiiia
Copy link
Author

gggiiia commented Jul 21, 2020

plus actually the promise is slow in general, no matter if highAccuracy is used or not, it just stay there for several seconds, at least the first time after the user accepts the persimmions, fun fact, if i call the function again it usually returns a value immediatly... cache is you? but only if you do the second request 1 second or so away from the first, otherwise it's just there loading for several seconds, not really know what is wrong with this plugin,is buggy, on some devices it just don't work, is slow, cache do not work, using navigator.geolocation for now, at least it works "everywhere" and is fast.

@LuisPerez94
Copy link

plus actually the promise is slow in general, no matter if highAccuracy is used or not, it just stay there for several seconds, at least the first time after the user accepts the persimmions, fun fact, if i call the function again it usually returns a value immediatly... cache is you? but only if you do the second request 1 second or so away from the first, otherwise it's just there loading for several seconds, not really know what is wrong with this plugin,is buggy, on some devices it just don't work, is slow, cache do not work, using navigator.geolocation for now, at least it works "everywhere" and is fast.

have you resolved this behavior?

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 30, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants