# Android hardware back button some time work some time not

**URL:** <https://forum.ionicframework.com/t/android-hardware-back-button-some-time-work-some-time-not/19417>\
**Category:** ionic-v1\
**Created:** [March 20, 2015, 5:21am UTC](https://forum.ionicframework.com/t/android-hardware-back-button-some-time-work-some-time-not/19417 "2015-03-20T05:21:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev18](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dev18](https://forum.ionicframework.com/u/dev18)\
**Post date:** [March 20, 2015, 5:21am UTC](https://forum.ionicframework.com/t/android-hardware-back-button-some-time-work-some-time-not/19417/1 "2015-03-20T05:21:29Z")

</div>

```
 $ionicPlatform.registerBackButtonAction(function(e) {
      if ($state.current.name == "app.wifipsw") { // your check here
        $state.go('tab.dash');
        //navigator.app.exitApp();
      } else {
        navigator.app.exitApp();
      }
    }, 100);

```

when i click back button it go to **tab.dash**.but some time app exit.

---

<div class="post-metadata">

**Author:** ![elSolo](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@elSolo](https://forum.ionicframework.com/u/elSolo)\
**Post date:** [March 21, 2015, 9:57am UTC](https://forum.ionicframework.com/t/android-hardware-back-button-some-time-work-some-time-not/19417/2 "2015-03-21T09:57:01Z")

</div>

Try

> $state.is(‘app.wifipsw’)

instead of

> $state.current.name == “app.wifipsw”

---

<div class="post-metadata">

**Author:** ![dev18](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dev18](https://forum.ionicframework.com/u/dev18)\
**Post date:** [March 21, 2015, 4:00pm UTC](https://forum.ionicframework.com/t/android-hardware-back-button-some-time-work-some-time-not/19417/3 "2015-03-21T16:00:30Z")

</div>

I have done this but still it has same behaviour.
