Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

Geolocation accuracy, caching and other service parameters

On a change value click (selected), my app compares the lat/lng of a saved location with your current location. If the current location isn't in range of the saved location then the javascript prompts the user to move closer to the target and to click again. This ensures that the user can only successfully check off an item if they are within a short distance of that object.

The problem I'm having is the caching of the current location. I need the current location to never be cached and to be accurate within a foot, and to respond quickly on change value or click.

Can that accuracy be that high and received quickly with "enableHighAccuracy" enabled or disabled? How do we ensure that the lat/lng points are never cached? And lastly, does the timeout matter in this instance?

Thanks!

Mike

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

Geolocation accuracy, caching and other service parameters

Hello,

How do you get a geolocation data? As it's stated here:
http://docs.appery.io/tutorials/build... ?

Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

Geolocation accuracy, caching and other service parameters

Thanks for the reply. My app works, but I have a problem with fine-tuning the geolocation calls so that it doesn't cache and so that it is accurate without any delay.

The examples don't describe what each service parameter does, which is why I ask.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Geolocation accuracy, caching and other service parameters

Hi Mike -

Here is an description of input parameters (http://docs.phonegap.com/en/3.3.0/cor... ):
[quote:]
enableHighAccuracy: Provides a hint that the application needs the best possible results. By default, the device attempts to retrieve a Position using network-based methods. Setting this property to true tells the framework to use more accurate methods, such as satellite positioning. (Boolean)

timeout: The maximum length of time (milliseconds) that is allowed to pass from the call to geolocation.getCurrentPosition or geolocation.watchPosition until the corresponding geolocationSuccess callback executes. If the geolocationSuccess callback is not invoked within this time, the geolocationError callback is passed a PositionError.TIMEOUT error code. (Note that when used in conjunction with geolocation.watchPosition, the geolocationError callback could be called on an interval every timeout milliseconds!) (Number)

maximumAge: Accept a cached position whose age is no greater than the specified time in milliseconds. (Number)
[/quote]

So to increase accuracy you have to change your parameters like it's shown on this screen shot: http://prntscr.com/35lv1t/direct

Also in this document (http://docs.phonegap.com/en/3.3.0/cor...) describes the output parameters:
[quote:]
latitude: Latitude in decimal degrees. (Number)

longitude: Longitude in decimal degrees. (Number)

altitude: Height of the position in meters above the ellipsoid. (Number)

accuracy: Accuracy level of the latitude and longitude coordinates in meters. (Number)

altitudeAccuracy: Accuracy level of the altitude coordinate in meters. (Number)

heading: Direction of travel, specified in degrees counting clockwise relative to the true north. (Number)

speed: Current ground speed of the device, specified in meters per second. (Number)[/quote]

Please take a look on "accuracy" output parameter for your goals.

Note: you can't set accuracy because it depends on device and location conditions specific. See more here: http://www.gps-basics.com/faq/q0121.s...

But you can read the current accuracy state.

Return to “Issues”