JavaScript – phonegap Android geolocation watchposition timeout
I am testing with Cordova 3.0.0 and Samsung Galaxy S3 4.1.2
When I test the phonegap full example to see the location: http://docs.phonegap.com/en/edge/cordova_ geolocation_ geolocation.md.html#geolocation.watchPosition
I get a first line with coords, and then I get an error:
code 3
message : Position retrieval timed out.
And it won't return to other locations. The code on my iPhone is the same. I test it when I walk, and so do when I'm in the car
I noticed that when I use Google Maps on Android devices, a GPS icon pops up on the top bar. When I start my application, it's not here
Manifest has set permissions correctly. My options are:
var options = { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true };
watchID = navigator.geolocation.watchPosition( onSuccess, one rror, options );
My application needs to work precisely
Thank you for your help
resolvent:
Well, after a few hours of testing, I managed to run watchposition on Android using Cordova 3.1.0
What you need to do: use HTML5 only API for geolocation, excluding: http://cordova.apache.org/docs/en/3.1.0/cordova_ geolocation_ geolocation.md.html#Geolocation
If you have used it in your project, delete it through the CLI: Cordova plug-in RM org.apache.cordova.geography
Of course, keep these lines in your Android list:
< uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
< uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
< uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
This is useful to me, please tell me if it is suitable for you. If necessary, I will release the code (but the complete sample work, for example)