Android hardware back button some time work some time not

 $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.

Try

$state.is(‘app.wifipsw’)

instead of

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

I have done this but still it has same behaviour.