Search code examples
androidphonegap-desktop-app

Closing (killing) and android App developed with Phonegap


I am developing a small App with Phonegap. I would like to add a button for the users to close/kill the app but it is still running in the background. I used the codes from this thread: Is it really posible to close a PhoneGap App? and used the following function:

function CloseApp() {
    if (confirm('Close this App?')){
        if (navigator.app) {
            navigator.app.exitApp();
        }else if (navigator.device) {
            navigator.device.exitApp();
        }
    }
}

Solution

  • Yes navigator.app.exitApp()will close the application, it may showed in recent apps tab but the app was closed. If you open the app again after closing it will load full application, if the app is not closed u will get last activity page.