I am writing an application that needs the user's current location coordinates. I use the Cordova Geolocation API and am developing in an Intel XDK environment.
In some cellphones (e.g. Samsung S3 and S4), the API cannot obtain the location and instead returns a timeout error. However, sometimes it works after restarting the phone.
I need a stable solution because the location is critical for my project. Here's my current code:
navigator.geolocation.getCurrentPosition(geolocationSuccess,
geolocationError,
{maximumAge:0,timeout: 7000, enableHighAccuracy: true});
I tried calling getCurrentPosition
with different parameters (changed maximumAge, timeout, etc.), but nothing seems to work.
Is there anything I can do to fix this issue? Are there perhaps some other plugins that allow me to get the user's location? Alternatively, can I somehow use the cellphones' native features for obtaining the location?