Hi,
I have problem with $cordovaGeolocation.getCurrentPosition() which is running as backgroundservice using cordova.plugins.backgroundMode on my android device marshmallow (6.0.1), it’s always return object PositionError : error.Code:3 error.Message: timeout.
this problem doesn’t appear on my android device version kitkat (4.4.2).
does anyone have this similliar problem? please help me…
here mycode:
$scope.updateposition = function() {
var posOptions = {timeout: 60000, enableHighAccuracy: true};
$cordovaGeolocation
.getCurrentPosition(posOptions)
.then(function (position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
var GPS = "latitude:"+lat+";"+"longitude:"+long;
//////console.log(GPS);
var d = new Date();
var n = d.toLocaleString();
memberpositionService.updateposition(GPS)
.then(function(data){
console.log('update position success');
cordova.plugins.backgroundMode.configure({
title:'update position success on '+n
});
},function(data){
console.log('update position failed');
cordova.plugins.backgroundMode.configure({
title:'update position failed on '+n
});
})
return $scope.GPS;
}, function(err) {
// error
console.log('fail get location'+err);
console.log('fail get location detail:'+err.code+' '+err.message);
cordova.plugins.backgroundMode.configure({
title:'fail get location '
});
});
};