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

mdg:geolocation ~ position won't be watched / asked again after error #62

Open
hems opened this issue Jun 3, 2015 · 4 comments · May be fixed by #87
Open

mdg:geolocation ~ position won't be watched / asked again after error #62

hems opened this issue Jun 3, 2015 · 4 comments · May be fixed by #87

Comments

@hems
Copy link

hems commented Jun 3, 2015

When onError is triggered we should set watchingPosition to false, so then we can call startWatchingPosition again ( and try to fetch the location again ).

At the moment if i received a TIMEOUT error, it doesn't retry and it seems that the app will only update the position if you refresh the page, when you could actually just call watchPosition again and get onPosition callback called.

@lorensr
Copy link
Contributor

lorensr commented Jun 27, 2015

I can reproduce this bug. To replicate, eg on Android:

  • Turn off system GPS
  • Open app
  • Turn on system GPS
  • Return to app, currentLocation() does not update
  • Quit and reopen app, currentLocation() gives location

It would be preferable if this package picks up on the fact that the permissions changed and it can now access GPS.

@hems
Copy link
Author

hems commented Jun 28, 2015

@lorensr in case you need a quickfix, it's pretty simple to roll your own "geolocation api", in my case i preferred to have it as an event emitter and just call "start" when i actually need to ask for permissions.

https://gist.github.com/hems/52823bf5a63d842abfee
( this came straight from my app code, so you need to tweak a couple of things.. )

@lorensr
Copy link
Contributor

lorensr commented Jul 7, 2015

Okay, so solution is to repeat the watchPosition call on a timer.

@hems
Copy link
Author

hems commented Jul 9, 2015

@lorensr i believe so, my solution isn't 100% ideal as well, but it did the job of asking permissions again if you go change your settings and come back to the app.

need some fine tuning though, once i make sure it's 100% i'll do a pull request

@hems hems changed the title mdg:geolocation ~ position won't be watched again after error mdg:geolocation ~ position won't be watched / asked again after error Jul 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants