0

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();
        }
    }
}
Community
  • 1
  • 1
GforGIS
  • 163
  • 10
  • You might have a read through [this post](http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon). – Mike M. Mar 21 '16 at 01:00
  • @MikeM. I went through the page you proposed I should read. I came up to the conclusion to leave it that way. Most of the apps I use on my Android phone would still appear on the recent apps tab anyway as mentioned by. – GforGIS Mar 24 '16 at 08:08

1 Answers1

0

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.

Naresh Kumar
  • 938
  • 5
  • 12