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.

[ Full content available at: 
https://github.com/apache/cordova-plugin-geolocation/issues/114 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to