I'm trying to use the plugin cordova-plugin-geolocation, but does not work, I get the following error:
Uncaught ReferenceError: geolocationSuccess is not defined
I have the plugin and permissions in the manifest correctly, simply does not work. If anyone knows the solution, I thank you for the help.
Android manifiest:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
Javascript
navigator.geolocation.getCurrentPosition(geolocationSuccess,
[geolocationError],
[geolocationOptions]);
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
');
};
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError);
change
navigator.geolocation.getCurrentPosition(geolocationSuccess,
[geolocationError],
[geolocationOptions]);
to
navigator.geolocation.getCurrentPosition(onSuccess,
onError,
{
maximumAge: 3000,
timeout: 5000,
enableHighAccuracy: true
}
);