Challenges with the default Geolocation API. One of theÂ primary limitations is the Geolocation API does not tell you how it got aÂ location. All locations are lumped together in a black box. Let me explain. On a smartphone or tablet, location data comes from one of threeÂ places: the GPS chipset, the cellular provider’s Location Service, or the browser’s Location Service. The W3C Geolocation API simply lumps these data points together. The end result is typically seen by the end user as significant and disturbingly wild jumps back and forth in the reported location, sometimes over large distances. A key to minimizing these fluctuations is to gain back control and understand which location provider created the latitudeÂ andÂ longitude point.
What geolocation data is available? With this plugin you’ll be able to programmaticallyÂ differentiate between the following geolocation data as well as get access toÂ GPS satellites meta data:
- Real-time GPS location – ThisÂ is data from the on-board GPS or some devicesÂ will allow it toÂ be the location data from an external GPS that is connectedÂ to the device via bluetooth.
- Cached GPS location – Most devices cache the last-known GPS location and it’s persistent even when the device is restarted.
- Real-time Network location triangulation – this is completely dependent onÂ devices and cellularÂ service providers. It may require WiFi to be turned on. It also may not be available in all countries or regions.
- Cached Network location –Â Most devices cache the last-known network-basedÂ location and it’s persistent even when the device is restarted.
- Determine a static outdoors location and only use GPS.
- While indoors turn on only network location. Do not use GPS.
- While in an urban area, use network location to get initial location before the GPS warms up and then turn off network location and only use GPS
- CompareÂ the differences between GPS and Network locations
How does this plugin help minimize location fluctuations? ThisÂ pluginÂ comes with a configuration option for turning on a buffer. You can set the size of the buffer, each new geolocation from the device will be added to it, and then pluginÂ will determine the geometric center based on all the locations in the buffer.
Are there any other advanced plugins? Yes, some Cordova plugins are focused on being activity based and will detect if you are walking, stopped, moving, etc. These plugins tend to work as apps that can be backgrounded.Â Feel free to browse the Cordova plug-in directory here.