Back Button Hardware Ionic PT-BR

Bom dia Pessoal estou com uma dúvida de como ativar o back button no app que eu estou desenvolvendo mas tudo que eu fiz até agora não funcionou!

na pagina app.component.ts

import { Component, ViewChild } from ‘@angular/core’;

import { Platform, AlertController, IonRouterOutlet, NavController } from ‘@ionic/angular’;

import { ScreenOrientation } from ‘@ionic-native/screen-orientation/ngx’;

import { Location } from ‘@angular/common’;

@Component({

selector: ‘app-root’,

templateUrl: ‘app.component.html’,

styleUrls: [‘app.component.scss’],

})

export class AppComponent {

@ViewChild(IonRouterOutlet, { static : true }) routerOutlet: IonRouterOutlet;

subscrible: any;

constructor(

private platform: Platform,

private screenOrientation: ScreenOrientation,

private alertController: AlertController,

private location: Location,

private nav: NavController

) {

this.InitializeApp();

this.backButtonEvent();

}

InitializeApp(){

this.platform.ready().then(() => {

  this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);

  console.log(this.screenOrientation.type); // logs the current orientation, example: 'landscape'

  this.platform.backButton.subscribeWithPriority(1, () => {

    this.nav.back();

  });

});

}

backButtonEvent(){

this.platform.backButton.subscribeWithPriority(10, () => {

  if (!this.routerOutlet.canGoBack()) {

    this.backButtonAlert();

  }else{

    this.location.back();

  }

  

});

}

async backButtonAlert(){

const alert = await this.alertController.create({

  message: 'Você precionou o botão voltar do seu celular!',

  buttons: [{

    text: 'Cancelar',

    role: 'cancel'

  },{

    text: 'Fechar App',

    handler: () => {

      navigator['app'].exitApp();

    }

  }]

});

await alert.present();

}

}