Hardware back button didnt work


#1

app.component.ts

platform.registerBackButtonAction(function (event) {
    let confirm = this.alertCtrl.create({
      title: 'EXİT?',
      message: 'Do you agree exit?',
      buttons: [
        {
          text: 'No',
          handler: () => {
            console.log('Disagree clicked');
          }
        },
        {
          text: 'Yes',
          handler: () => {
            console.log('Agree clicked');
            this.platform.exitApp();
          }
        }
      ]
    });
    confirm.present();
    });

But it didnt work


#2

Did you put it inside your platform.ready()?