title: Ionic 2 function call not working from inside a function
body: <p>I am trying to show toast message if GPS is enabled or if not show a GPS turn on request dialog and if accept then show the toast message in a ionic2 android app after view loaded. The problem is when I GPS not enabled app ask for turn it on by a dialog. But When I turn on GPS it doesn't show toast message "Loaded 2" but it shows "Loaded 2" in console log. How can I call this <code>presentToastMsg</code> function after request.</p>
  
  <pre><code>ionViewDidEnter() {
  let options = {
    enableHighAccuracy: true,
    timeout: 1500
  };
  
  this.geolocation.getCurrentPosition(options).then((position) =&gt; {
    console.log('Loaded 1');
    this.presentToastMsg('Loaded 1');
  }).catch(function (error) {
    cordova.plugins.locationAccuracy.canRequest(function (canRequest) {
      if (canRequest) {
        cordova.plugins.locationAccuracy.request(function (success) {
          console.log('Loaded 2');
          this.presentToastMsg('Loaded 2');
        }, function (error) {
          console.log(error);
          this.presentToastMsg(error);
        },
          cordova.plugins.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY);
      }
    });
  });
  }
  
  presentToastMsg(msg) {
  let toast = this.toastCtrl.create({
    message: msg,
    duration: 3000,
    position: 'bottom',
    cssClass: "toast-info"
  });
  
  toast.present();
  }
  </code></pre>