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

Sriram Kalyanasundaram updated CB-14214:
----------------------------------------
    Description: 
Location is turned on the phone. Error code : 3 timeout expired - if the 
timeout is set to 10 seconds. It sometimes takes up to 20 seconds to return. 

Code : 

var app = {
 // Application Constructor
 initialize: function()

{ document.addEventListener('deviceready', this.onDeviceReady.bind(this), 
false); }

,

// deviceready Event Handler
 //
 // Bind any cordova events here. Common events are:
 // 'pause', 'resume', etc.
 onDeviceReady: function()

{ this.receivedEvent('deviceready'); }

,

// Update DOM on a Received Event
 receivedEvent: function(id)

{ var parentElement = document.getElementById(id); var listeningElement = 
parentElement.querySelector('.listening'); var receivedElement = 
parentElement.querySelector('.received'); 
listeningElement.setAttribute('style', 'display:none;'); 
receivedElement.setAttribute('style', 'display:block;'); console.log('Received 
Event: ' + id); navigator.geolocation.getCurrentPosition(onSuccess, onError); }

};
 var onSuccess = function(position)

{ alert('Latitude: ' + position.coords.latitude + '\n' + 'Longitude: ' + 
position.coords.longitude + '\n' + 'Altitude: ' + position.coords.altitude + 
'\n' + 'Accuracy: ' + position.coords.accuracy + '\n' + 'Altitude Accuracy: ' + 
position.coords.altitudeAccuracy + '\n' + 'Heading: ' + position.coords.heading 
+ '\n' + 'Speed: ' + position.coords.speed + '\n' + 'Timestamp: ' + 
position.timestamp + '\n'); }

;

// onError Callback receives a PositionError object
 //
 function onError(error)

{ alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); }

app.initialize();

  was:
Location is turned on the phone. Error code : 3 timeout expired.

Code : 

var app = {
 // Application Constructor
 initialize: function()

{ document.addEventListener('deviceready', this.onDeviceReady.bind(this), 
false); }

,

// deviceready Event Handler
 //
 // Bind any cordova events here. Common events are:
 // 'pause', 'resume', etc.
 onDeviceReady: function()

{ this.receivedEvent('deviceready'); }

,

// Update DOM on a Received Event
 receivedEvent: function(id)

{ var parentElement = document.getElementById(id); var listeningElement = 
parentElement.querySelector('.listening'); var receivedElement = 
parentElement.querySelector('.received'); 
listeningElement.setAttribute('style', 'display:none;'); 
receivedElement.setAttribute('style', 'display:block;'); console.log('Received 
Event: ' + id); navigator.geolocation.getCurrentPosition(onSuccess, onError); }

};
 var onSuccess = function(position)

{ alert('Latitude: ' + position.coords.latitude + '\n' + 'Longitude: ' + 
position.coords.longitude + '\n' + 'Altitude: ' + position.coords.altitude + 
'\n' + 'Accuracy: ' + position.coords.accuracy + '\n' + 'Altitude Accuracy: ' + 
position.coords.altitudeAccuracy + '\n' + 'Heading: ' + position.coords.heading 
+ '\n' + 'Speed: ' + position.coords.speed + '\n' + 'Timestamp: ' + 
position.timestamp + '\n'); }

;

// onError Callback receives a PositionError object
 //
 function onError(error)

{ alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); }

app.initialize();


> Timeout when calling getCurrentPosition in Android
> --------------------------------------------------
>
>                 Key: CB-14214
>                 URL: https://issues.apache.org/jira/browse/CB-14214
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-geolocation
>         Environment: Cordova version : 8.0.0
>  
>            Reporter: Sriram Kalyanasundaram
>            Priority: Critical
>         Attachments: app-debug.apk, source.zip
>
>
> Location is turned on the phone. Error code : 3 timeout expired - if the 
> timeout is set to 10 seconds. It sometimes takes up to 20 seconds to return. 
> Code : 
> var app = {
>  // Application Constructor
>  initialize: function()
> { document.addEventListener('deviceready', this.onDeviceReady.bind(this), 
> false); }
> ,
> // deviceready Event Handler
>  //
>  // Bind any cordova events here. Common events are:
>  // 'pause', 'resume', etc.
>  onDeviceReady: function()
> { this.receivedEvent('deviceready'); }
> ,
> // Update DOM on a Received Event
>  receivedEvent: function(id)
> { var parentElement = document.getElementById(id); var listeningElement = 
> parentElement.querySelector('.listening'); var receivedElement = 
> parentElement.querySelector('.received'); 
> listeningElement.setAttribute('style', 'display:none;'); 
> receivedElement.setAttribute('style', 'display:block;'); 
> console.log('Received Event: ' + id); 
> navigator.geolocation.getCurrentPosition(onSuccess, onError); }
> };
>  var onSuccess = function(position)
> { alert('Latitude: ' + position.coords.latitude + '\n' + 'Longitude: ' + 
> position.coords.longitude + '\n' + 'Altitude: ' + position.coords.altitude + 
> '\n' + 'Accuracy: ' + position.coords.accuracy + '\n' + 'Altitude Accuracy: ' 
> + position.coords.altitudeAccuracy + '\n' + 'Heading: ' + 
> position.coords.heading + '\n' + 'Speed: ' + position.coords.speed + '\n' + 
> 'Timestamp: ' + position.timestamp + '\n'); }
> ;
> // onError Callback receives a PositionError object
>  //
>  function onError(error)
> { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); }
> app.initialize();



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to