Search code examples
ionic-frameworkionic5

How can I close an Ionic 5 app from code?


I can't find the way to close an app in Ionic 5 system. Looks like the way to do it in Ionic 4 is not working for Ionic 5. Is it possible to do?


Solution

  • closeApp() { 
        this.platform.backButton.subscribeWithPriority(999999, () => { 
        navigator['app'].exitApp();
        // or trigger any action you want to achieve
        }) //Amended missing a closing bracket
    }