# Hardware back goin two pages back-Capacitor and Ionic Angular

**URL:** <https://forum.ionicframework.com/t/hardware-back-goin-two-pages-back-capacitor-and-ionic-angular/219565>\
**Category:** Capacitor\
**Created:** [January 20, 2022, 6:05am UTC](https://forum.ionicframework.com/t/hardware-back-goin-two-pages-back-capacitor-and-ionic-angular/219565 "2022-01-20T06:05:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayuriparopate](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@mayuriparopate](https://forum.ionicframework.com/u/mayuriparopate)\
**Post date:** [January 20, 2022, 6:05am UTC](https://forum.ionicframework.com/t/hardware-back-goin-two-pages-back-capacitor-and-ionic-angular/219565/1 "2022-01-20T06:05:02Z")

</div>

The hardware back functionality of capacitor 3 is going two page back but when running normally but in debug mode, its working fine. Why this is happening and Kindly suggest solution

---

<div class="post-metadata">

**Author:** ![thomasvidas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/thomasvidas/32/137760_2.png) [@thomasvidas](https://forum.ionicframework.com/u/thomasvidas)\
**Post date:** [January 24, 2022, 7:07pm UTC](https://forum.ionicframework.com/t/hardware-back-goin-two-pages-back-capacitor-and-ionic-angular/219565/2 "2022-01-24T19:07:01Z")

</div>

Are you using `@capacitor/app` to listen for back button presses or handing it some other way?

---

<div class="post-metadata">

**Author:** ![mani0011](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mani0011](https://forum.ionicframework.com/u/mani0011)\
**Post date:** [January 25, 2022, 4:21am UTC](https://forum.ionicframework.com/t/hardware-back-goin-two-pages-back-capacitor-and-ionic-angular/219565/3 "2022-01-25T04:21:49Z")

</div>

Check your backbutton subscription function. It must be configured properly, Unsubscribed safely on next page navigation to work properly.  
Try something like the below

```auto
backbuttonfunction=null; // Member variable to store back button function
ionViewWillEnter(){
this.backbuttonfunction=this.platform.backButton.subscribe(()=>{
// Your subscription logics
});
ngOnDestroy(){
this.backbuttonfunction.unsubscribe(); // Unsubscribing your subscription
}
}

```
