locked
Exiting App, in A Cordova based multi device hybrid application

    Question

  • 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.

    Saturday, February 21, 2015 8:06 AM

Answers

  • Hi Manish,

    To exist the app, we can use window.close()

    Update:

    Some of our senior engineer point out my 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.

    Sorry for my previous wrong direction. To safely quit the app, please do not handle the back button on the main page, the only purpose to override the back button is when the app needs to redirect the button to navigate back within the app.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, February 23, 2015 1:53 AM
    Moderator
  • Hi Manish,

    That was about application life cycle: Application lifecycle

    We have documentation for you: How to suspend an app and How to resume an app for app goes to background or comes to foreground.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 24, 2015 6:13 AM
    Moderator

All replies

  • Hi Manish,

    To exist the app, we can use window.close()

    Update:

    Some of our senior engineer point out my 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.

    Sorry for my previous wrong direction. To safely quit the app, please do not handle the back button on the main page, the only purpose to override the back button is when the app needs to redirect the button to navigate back within the app.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, February 23, 2015 1:53 AM
    Moderator
  • Thanks a lot James. That helped like anything Man. You Saved  my Life..
    Monday, February 23, 2015 3:54 AM
  • James, i have been into cordova apps recently and i am trying to port an existing cordova app, developed using AngularJS into Windows 8.1 platform.

    Now the app seems to be working fine on the emulator and the development unlocked device. However, when the same app is uploaded over windows phone store, it closes after the splash screen.

    Is there any specific steps of process i must follow to generate the build or should i assume that windows 8.1 Cross platform apps don't support angularjs ??

    Monday, February 23, 2015 12:18 PM
  • Hello James,

    Suppose i am pressing the back button and the application goes to background.

    Now is there any event that i can capture when this app goes in the background and when the app again comes to foreground ??

    Tuesday, February 24, 2015 6:06 AM
  • Hi Manish,

    That was about application life cycle: Application lifecycle

    We have documentation for you: How to suspend an app and How to resume an app for app goes to background or comes to foreground.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 24, 2015 6:13 AM
    Moderator
  • Hello James,

    I have read about the Application Life cycle, it says that these events are raised when the system suspends or resumes your app, does the same apply for the instance when the user himself /  herself presses the back button and the app goes into background ??

    Tuesday, February 24, 2015 8:47 AM
  • Hi Manish,

    Yes.

    An app can be suspended when the user switches away from it or when the device enters a low power state. Most apps stop running when the user switches away from them.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 26, 2015 5:56 AM
    Moderator