# hardwareBackButton not working in ionic5

**URL:** <https://forum.ionicframework.com/t/hardwarebackbutton-not-working-in-ionic5/189684>\
**Category:** Ionic Framework\
**Created:** [May 19, 2020, 8:28am UTC](https://forum.ionicframework.com/t/hardwarebackbutton-not-working-in-ionic5/189684 "2020-05-19T08:28:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhurihotwax](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@madhurihotwax](https://forum.ionicframework.com/u/madhurihotwax)\
**Post date:** [May 19, 2020, 8:28am UTC](https://forum.ionicframework.com/t/hardwarebackbutton-not-working-in-ionic5/189684/1 "2020-05-19T08:28:15Z")

</div>

For Ionic 4 check out the config option described here: [https://ionicframework.com/docs/angular/config](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.

---

<div class="post-metadata">

**Author:** ![pitahausen](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@pitahausen](https://forum.ionicframework.com/u/pitahausen)\
**Post date:** [May 20, 2020, 4:30am UTC](https://forum.ionicframework.com/t/hardwarebackbutton-not-working-in-ionic5/189684/2 "2020-05-20T04:30:38Z")

</div>

Hi. you can use the following event

backButtonEvent() {  
document.addEventListener(“backbutton”, ()=\>{  
console.log(“back button”);  
}, false);  
}

---

<div class="post-metadata">

**Author:** ![ldebeasi](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ldebeasi/32/147501_2.png) [@ldebeasi](https://forum.ionicframework.com/u/ldebeasi)\
**Post date:** [May 20, 2020, 4:10pm UTC](https://forum.ionicframework.com/t/hardwarebackbutton-not-working-in-ionic5/189684/3 "2020-05-20T16:10:21Z")

</div>

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](https://ionicframework.com/docs/developing/hardware-back-button#exiting-the-app).
