I'm writing a Cordova/Phonegap app and I want to use Geolocation plugin to obtain longitude and latitude. This is my code:
$scope.showCoord = function() {
var onSuccess = function(position) {
console.log("Latitude: "+position.coords.latitude);
console.log("Longitude: "+position.coords.longitude);
};
function onError(error) {
console.log("Code: "+error.code);
console.log("Message: "+error.message);
};
navigator.geolocation.getCurrentPosition(onSuccess, onError, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });
}
When I try this plugin with the GPS it works very well but when I try it without GPS I receive timeout...I change the timeout to 100000 but doesn't work. Furthermore in my config.xml I added this code:
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.GeoBroker" />
</feature>
How can I fix it?