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/09/17 18:30:21 UTC

[GitHub] fernandoocf removed a comment on issue #114: Not working on Android devices

fernandoocf removed a comment on issue #114: Not working on Android devices
URL: https://github.com/apache/cordova-plugin-geolocation/issues/114#issuecomment-422121048
 
 
   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) => {
                   // populate my data
                 });
               } else {
                 this.askForGPS();
               }
             });
           } 
         });
       } else { // gets my browser location
         navigator.geolocation.getCurrentPosition(position => {
           // populate my data
         }, (err) => {
           // handle err
         });
       }
     }`
   
   `askForGPS() {
       const alert = this.alertCtrl.create({
             title: 'Title',
             message: 'Ask here for HIGH ACCURACY GPS',
             buttons: [
               {
                 text: 'Cancel',
                 role: 'cancel',
                 handler: () => {
                   alert.dismiss();
                 }
               },
               {
                 text: 'Go to Config',
                 handler: () => {
                   this.diagnostic.switchToLocationSettings();
                 }
               }
             ]
           });
           alert.present();
     }`
   
   After this I need that the user set the High Accuracy mode and accept google terms to use.

----------------------------------------------------------------
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