Hi. I have a problem about android backbutton. backbutton works normally, if I don’t step in that. I wrote a code like below:
var backButtonPressCount = 0;
$ionicPlatform.registerBackButtonAction(function () {
if ($state.current.name == "home") {
if (backButtonPressCount == 0) {
backButtonPressCount++;
$cordovaToast.showShortBottom('Please click again for exit.');
$timeout(function () { backButtonPressCount = 0; }, 5000);
} else {
navigator.app.exitApp();
}
} else {
// $timeout(function () {
$ionichistory.goBack();
// }, 50);
}
}, 100);
If app state is home, it quit application when double click of bckbutton. It works ok. But goback part does not work. Why can it work?
Thanks in advance.