Hi,
On Android I always have undefined as a result of calling example through console:
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'); } navigator.geolocation.getCurrentPosition(onSuccess, onError);
Is it a bug in plugin or something I can fix on my side?
Thank you
Hello, Mykola,
Hmm, there were two things I couldn't understand:
Best regards,
Carlos Simões
Hi Carlos,
Example is from git page https://github.com/OutSystems/cordova-plugin-geolocation.git
Meanwhile I found the source of the problem in my device settings. So this issue and this https://www.outsystems.com/forums/discussion/21261/getlocation-always-has-error-timeout-expired-on-android/ can be marked as solved :)
Cool! Out of curiosity, was it app permissions?
Not only. App permission I had to disable/enable few times and restart the device (can be just my device problem). Also the was problem in my UI flow so when device started get gps info it didn't refresh the "no gps" message properly.
Ok, thanks! Feel free to ask if there's anything else you need to clear up!