i m trying to override hardware back button functionality. so,everything works fine with below code.
but,there are two $ionicModal in my app. As $ionicModal is opened and closed.Hardware back button stops working,app cannot closed with back button? Not even $ionicPlatform.registerBackButtonAction function is been called.
$state.$current.name == "";
var backbutton=0;
$ionicPlatform.registerBackButtonAction(function (event) {
if (($state.$current.name == "app.intro") ||
($state.$current.name == "app.main.home") ||
($state.$current.name == "app.account") ||
($state.$current.name == "app.myBusiness")||
($state.$current.name == "app.support")||
($state.$current.name == "app.noConnection")) {
if(backbutton==0){
backbutton++;
window.plugins.toast.showLongBottom('Press again to exit');
$timeout(function(){backbutton=0;},3000);
}else{
navigator.app.exitApp();
}
console.log("one");
}else if($state.$current.name == "app.welcome.takeControl") {
console.log("two");
$state.go("app.main.home");
}else{
console.log("three");
navigator.app.backHistory();
}
}, 100);
Thank you..