Search code examples
cordovawindows-phone-8.1winjsmulti-device-hybrid-apps

Exit application in Windows Phone 8.1 multi device hybrid app


i have been recently trying on with Cordova Multi device hybrid apps, targeted for Windows phone 8.1. To add more to that, i add windows as the platform in the cordova project.

Now my question is, is there any way in which i can terminate my application in the user device, or even move it to background just to MIMIC the exit app feature in Windows phone 8.1 device, with or without using WinJS library ??

I am trying to capture the back click and in turn exit the app on back click.

Note that i am already capturing the back button click and handling navigation accordingly.


Solution

  • Hell, It was just one line.

    You can close your windows 8.1 apps using window.close();

    Edit

    Some of Microsoft engineers point out the mistake here: window.close() is not a safe way to implement the app, calling this method will break app suspend and resume also might lose data when user back to the app.

    window.close() is only used to call when the app has reached an unrecoverable state.

    More details can be found on this thread --> Exiting App, in A Cordova based multi device hybrid application