You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/10/10 14:33:26 UTC
[GitHub] terminaltor commented on issue #114: Not working on Android devices
terminaltor commented on issue #114: Not working on Android devices
URL: https://github.com/apache/cordova-plugin-geolocation/issues/114#issuecomment-428595992
> Here is my solution:
>
> You will need use:
> Platform: https://ionicframework.com/docs/api/platform/Platform/
> Diagnostic: https://ionicframework.com/docs/native/diagnostic/
> Geolocation: https://ionicframework.com/docs/native/geolocation/
> Location Accuracy: https://ionicframework.com/docs/native/location-accuracy/
>
> ```
> getUserPosition() {
> const HIGH_ACCURACY = 'high_accuracy'';
> 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) => {
> // populate my data
> });
> } 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 =)
Works for me... thanks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org