Search code examples
cordovagoogle-mapsgeolocationcordova-pluginsionic3

Difference between cordova geolocation.watchposition and background geolocation?


I am aware that the Cordova geolocation.watchposition retrieves periodic updates about the current geographic location of the device.

But it seems that 'background geolocation' that comes with Ionic does the same thing.

Can anyone please clarify the difference between the two?


Solution

  • You would normally use the "plain" geolocation watch position in an app where you wish to (probably) show the persons position on a map, and keep it updated if/when they move. Typically only when someone is actually using your app. The will normally use the most accurate form of geolocation enabled (GPS).

    The background geolocation plugin is meant for when you want to have your application log or react to location events so you would usually use this for a lower power usage "always on" type scenario, which would normally use less accurate methods for geolocation or even vary it a bit depending on the situation. This also supports the OS native detection of when the phone is moving, still, stopped, started moving, etc.