Android hardware back button resets app, possible to avoid?


I’ve made a fairly big app using Ionic Framework. When starting the app it takes about 5 seconds for it to show.

If this delay would only happen when the app is started it would be fine. When you press Android hardware home button or the hardware context switch button, the app is just suspended and it’s continuing to run where it was when you come back, no delay at all. However if you press the hardware back button (on the home screen) the app is suspended as expected but then when you return to the app, the app is reloaded, seems like it corresponds to pressing “reload” in the browser, and the 5 second delay is there (and view state is lost etc).

This resetting and the long delay that follows is very annoying.

It’s well documented how to catch the hardware back button and do things like showing a popup “are you sure you want to exit?”, but that’s just wrong, that’s not how normal apps work. You don’t exit apps, you suspend them, and when you return to them it is where it was, no delay. Sure it would be possible to have a state save and state restore, but with a 5 second startup time it’s just not acceptable as many users use both back and home for the same thing.

What I would like to happen is that the hardware back button works like the hardware home button, suspending without resetting/reloading.

A workaround could be to catch the back button and trigger a home button, is that possible to do, or is there some other sort of workaround?


I found a solution myself.
Install this cordova plugin

cordova plugin add cordova-plugin-backbutton

The override the back button action and trigger a goHome() instead of a normal back.

.run(function($ionicPlatform) {
    $ionicPlatform.registerBackButtonAction(function (event) {
        if (on home screen) {
        } else {
    }, 100);


hi…maybe you know the answer…but if i have a single page app how can i do?
I mean the app is a file browser, is a simple list of file in the device, i have my back button in app and i want to use the hardware back button to go back in list file directory or exit if is in the main directory, any idea?