[SOLVED] How to exit the app in v2

$$(document).on(‘click’, ‘.closeWin’, function () {
app.dialog.confirm(‘Exit?’, ‘Exit’, function () { window.close(); });
});
this code does not work.
help please, in advance thank you!

In cordova app it can be achieved like:

window.navigator.app.exitApp();

Now tried, not working. This function seems to apply to v1

Or I’m not there it prescribed?

this is Cordova api and doesn’t related to F7

How do I write this function in Cordova

In same place:

$$(document).on(‘click’, ‘.closeWin’, function () {
window.navigator.app.exitApp();
});

oh, it’s not working. I press, nothing happens. What could be the reason?

Two reasons:

  • you forgot to include cordova.js
  • if it is iOS device. Won’t work in iOS

Thank you very much, I thought that, it connects automatically when you create an apk. The question is closed.

No, the app just minimizes, when the call goes to the home screen

What to do? Is there a solution?

Nothing, it is all what is possible. In 99.99% of cases minimizing the app is totally enough

May I know why you want to exit app? App design is not the same as windows platform, we may come up with a better solution if we know the story behind

The only reason i see that there is somthing need to be done on app open. In this case $(document).on('resume', ...) event handler must be used

The customer wants the application to close.

Say him it is impossible, and it is true :smiley:

I can’t event remember any of mobile applications that closes/killed themeselfs

You should tell the client that mobile app is not running in this way unless the app is crashed or out of memory

I understand, but now I can show our correspondence.