[
https://issues.apache.org/jira/browse/CB-6078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13942303#comment-13942303
]
Joe Bowser commented on CB-6078:
--------------------------------
Are you using the latest plugin, which adds the permissions for Geolocation? If
not, you should be using that. Also, you have to make sure you're not in any
energy saving mode. What device is still on Android 4.0.4 that you're testing
on? The Motorola RAZR?
> Geolocation watchPosition consistently timing out on Android 4.0.4 with
> Cordova 3.3.0
> -------------------------------------------------------------------------------------
>
> Key: CB-6078
> URL: https://issues.apache.org/jira/browse/CB-6078
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android, CordovaJS
> Affects Versions: 3.3.0
> Reporter: Clay Benoit
>
> I am unable to get watchPosition to return more than one position using
> v3.3.0 on Android 4.0.4 and Android 4.4.0. I have tried various combinations
> of timeout, maximumAge and enableHighAccuracy and the results are all the
> same. That is, I get the first position and then a timeout. I never see the
> position change even if the device is moving. On iOS, my scaled down sample
> updates with minor movements of the device. Here is the JavaScript I'm using:
> var _options = {
> maximumAge: 0,
> timeout: 60000,
> enableHighAccuracy: true
> };
> // Wait for Cordova to load
> //
> document.addEventListener("deviceready", onDeviceReady, false);
> // Cordova is ready
> //
> function onDeviceReady() {
> navigator.geolocation.watchPosition(onSuccess, onError, _options);
> }
> // onSuccess Geolocation
> //
> function onSuccess(position) {
> var info = 'Latitude: ' + position.coords.latitude + '<br />' +
> 'Longitude: ' + position.coords.longitude + '<br />' +
> 'Altitude: ' + position.coords.altitude + '<br />' +
> 'Accuracy: ' + position.coords.accuracy + '<br />' +
> 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
> 'Heading: ' + position.coords.heading + '<br />' +
> 'Speed: ' + position.coords.speed + '<br />' +
> 'Timestamp: ' +
> position.timestamp + '<br />';
> $("#results").html(info);
> console.log(info)
> }
> // onError Callback receives a PositionError object
> //
> function onError(error) {
> alert('code: ' + error.code + '\n' +
> 'message: ' + error.message + '\n');
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)