Hardware back button with Ionic 4 Disable

It is 2020 now and i’m using Ionic 5 with Angular 9.
The solution that should work
IonicModule.forRoot({hardwareBackButton: false})
Still isn’t solved and still isn’t working

The soltion with the subscription on every component also isn’t working anymore

const sub = this.platform.backButton.subscribeWithPriority(9999, () => {
  // Do nothing
});

SO that leaves us the eventlistener

ionViewDidEnter() {
    document.addEventListener("backbutton",function(e) {
      // Do nothing
    }, false);
}

This one is working fine for Android at this moment and it follows the development guidelines from Angular

I’m searching for a solution where i can add the eventlistener only ones for the complete application

1 Like