Here is my solution:
getUserPosition() {
if (this.platform.is('cordova')) {
this.diagnostic.isLocationEnabled().then(enabled => {
if (enabled) {
this.diagnostic.getLocationMode().then(locationMode => {
if (locationMode.HIGH_ACCURACY) {
this.geolocation.getCurrentPosition().then((position) => {
this.populatePositionData(position);
});
} else {
this.askForHighAccuracy();
}
});
} else {
// handle if user deny location
}
});
}
}
askForHighAccuracy() {
this.locationAccuracy
.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(()
=> {
this.geolocation.getCurrentPosition().then((position) => {
// populate my data
});
});
}
After this I need that the user set the High Accuracy mode and accept google
terms to use.
Hope it work for you guys =)
[ Full content available at:
https://github.com/apache/cordova-plugin-geolocation/issues/114 ]
This message was relayed via gitbox.apache.org for [email protected]