You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Joe Bowser (JIRA)" <ji...@apache.org> on 2014/03/25 19:56:24 UTC

[jira] [Resolved] (CB-6078) Geolocation watchPosition consistently timing out on Android 4.0.4 with Cordova 3.3.0

     [ https://issues.apache.org/jira/browse/CB-6078?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Bowser resolved CB-6078.
----------------------------

    Resolution: Cannot Reproduce

I tested this on the Motorola RAZR, which is stuck on Android 4.0.4, and I didn't have this problem.  I did have to go into the configuration and turn on both Google Location Services and Use GPS Satellites, and I have a feeling that these are turned off by default for power-saving.

> 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)