Hardware back button with Ionic 4 Disable


#1

Hi everyone,
How do I disable the hardware back button in android? I’ll explain. I would like the click to always remain on the same page it’s possible?
thanks


#2

Have you tried this change in the app,module.ts?

IonicModule.forRoot({hardwareBackButton: false})

#3

Maybe something like

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

#4

hi yes i’ve try but not work :frowning:


#5

I’ve try your solution but not work, the event not fire


#6

I am looking for how to do so only the back button material shipments on a specific page without taking into account the battery


#7

finally I’ve found a solution, this work!!!

ionViewDidEnter() {
    document.addEventListener("backbutton",function(e) {
      console.log("disable back button")
    }, false);
}