How to exit the app?

The document says:


, but it doesn’t work.

in 5 years i’ve never seen an app with an exit / quit button!


It doesn’t work in ? Android? iOS ? Chrome?

1 Like

@Calendee Oh, Thanks for your help. I’m sorry I didn’t express clearly the platform is, your link makes me understand it.

hey i want to close the app when user on login screen and pressed back button …how i close or exit app .???

This is what I did on a recent app built, Toaster service referred to below is just a wrapper for the cordova-plugin-x-toast functionality.

var warnedExit = false;

// capture all instances of the hardware back button and do some custom behaviors
$ionicPlatform.registerBackButtonAction(function(event) {
            // if we have reached the beginning of the history tree
            if (!$ionicHistory.backView()) {
                // check to see if we have warned them before
                if (!warnedExit) {
                    // stop the navigation if the App is about to exit

                    // flag that we have warned the user
                    warnedExit = true;

                    // show the instruction to press back again to exit
                    Toaster.showLong('Press back again to exit.');

                    // give the user 3 seconds before switching the warned flag back to false and start all over again
                    $timeout(function () {
                        warnedExit = false;
                    }, 3000);
                } else {
            } else {
        }, 1000);

if (navigator);