[Location Plugin] Too many GPS measurements with OnPositionChanged

[Location Plugin] Too many GPS measurements with OnPositionChanged

  
Forge Component
(10)
Published on 2016-12-15 by OutSystems R&D
10 votes
Published on 2016-12-15 by OutSystems R&D

I use the LocationPlugin in my app and ran some tests. I found that OnPositionChanged is not really what is says it is: i get a lot of records with the same position (5 decimal digits accurate, see screenshot). I got more than 500 records in an 8 minute test. This will drown the battery very fast.

Is it possible to implement a frequency by which a GPS measurement is taken?

Kind regards,

Leen Rietveld.

Hello, Leen,

I did some digging around and found out that the Geolocation plugin we forked from doesn't support setting an update interval, due to the fact that Location Managers in both iOS and Android are event driven, as opposed to periodical (see this, for further details).

Furthermore, the Android implementation is done relying on HTML5's watchPosition API, which itself doesn't allow setting an update interval.

If you're targeting Android, you could try this plugin instead, which does allow to configure periodicity, but sadly, there's no iOS version.

Would this do? Please let us know if you need further help!

Best regards,

Carlos Simões

Hi Carlos,

I'm targeting Android only, so thank you for your suggestion. I'm going to try that plugin.

Kind regards,

Leen.