@compfrkz wrote:
Hi i am trying trying to turn on the location using diagnostic and when i try to get geo coordinates instantly its not working its taking around 10 sec if i start the gps and for subsequent calls geo location is got instantly any way to reduce the time for first call?
my code snippet
if (window.cordova) { cordova.plugins.diagnostic.isLocationEnabled(function(enabled) { // alert("Location is " + (enabled ? "enabled" : "disabled")); if(!enabled){ cordova.plugins.locationAccuracy.request(function (success){ console.log("Successfully requested accuracy: "+success.message); $cordovaGeolocation .getCurrentPosition(posOptions) .then(function (position) { $scope.lat = position.coords.latitude; $scope.lng = position.coords.longitude; }); }, function (error){ console.error("Accuracy request failed: error code="+error.code+"; error message="+error.message); if(error.code !== cordova.plugins.locationAccuracy.ERROR_USER_DISAGREED){ if(window.confirm("Failed to automatically set Location Mode to 'High Accuracy'. Would you like to switch to the Location Settings page and do this manually?")){ cordova.plugins.diagnostic.switchToLocationSettings(); } } }, cordova.plugins.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY); } }, function(error) { alert("The following error occurred: " + error); }); }
it takes around 10 sec when the location is turned on for first time any idea to reduce time on first call?
Posts: 1
Participants: 1