How to hold back twice to exit

hey guys,

i don’t know if this is still relevant but I discovered something I couldn’t find in over a year of googling. In order to have the cleanest way possible to handle back button quit without having to mess with back-button defaults, use this snippet:

good luck :slight_smile:

        this.oldexitappfn = this.platform.exitApp;
        this.platform.exitApp = () => {
            if (/* condition to exit app is present */) {
                this.platform.exitApp = this.oldexitappfn;
                this.platform.exitApp();
            } else {
                /* don't exit and do something else */
            }
        }

I found this out without any reference online so this might be the first one, and it works :slight_smile: