For Ionic 4 check out the config option described here: https://ionicframework.com/docs/angular/config
and I have applied hardwareBackButton : true inside my app.module.ts but it will not working in Android device .
Currently : Not exit the Android app on backPressButton pressed (remain on Home page).
Expected : App should be exit as default android app worked.
Thank you in advanced.
Hi. you can use the following event
backButtonEvent() {
document.addEventListener(“backbutton”, ()=>{
console.log(“back button”);
}, false);
}
Hey there,
By default Ionic apps do not exit when pressing the hardware back button. We have examples in the documentation for how to implement this logic into your application: https://ionicframework.com/docs/developing/hardware-back-button#exiting-the-app.