How to detect "Don't Allow"

hi , in there any way in ionic to detect location permission don’t allow actually my code flow work fine with “Allow” option but can’t catch error on “Don’t Allow” 44

i’m try to handle location permission denied .can anyone help me

You can catch that when the location promise is rejected.

component.ts

this.geolocation.getCurrentPosition().then(data => {
   // Promise Resolved. You were ALLOWED.
}).catch(error => {
   // Promise Rejected. An error has occurred or you were DISALLOWED.
   console.log(error); // Check the content of "error" for details.
});

thanks @cnswico your answer is right but catch section couldn’t execute some code like
this.nav.push(pageName,{data});
this.platform.exitApp();
navigator.app.exitApp();

i have no idea how to handle it please help

here my catch section code
.catch((error) => {
if (error.code == 1 && this.platform.is(‘ios’)) {
navigator.notification.prompt(

            function (obj) { 
                    if(obj.buttonIndex==2){
                            cordova.plugins.diagnostic.switchToSettings();
                    }else{
                            console.log("input: "+obj.input1); 
                             this.navCtrl.push(StationList,{code:obj.input1});
            } },                      
            "Title",                            
            ['ZipCode','Settings'],                          
          );

    }

  });

Change that to an arrow function

obj => {
    // ...
}