Hi devs,Is there a way we can catch app exit event in case of forceful closing of application. We are maintaining a session in our app and we invalidate it when user logs out properly. But in case of minimizing and forcefully quitting the app the session will not get invalidate till it does automatically after 30 mins of no usage.Since we do not allow multiple session of one user it will be difficult for user to wait till that period, hence the need of capturing app exit event so that we can invalidate the running session.ThanksRahul
you could send a heartbeat every ~30 seconds via js and ajax.
Looks like you'll have to write some native code for both platforms, shouldn't be that hard.
http://developer.android.com/reference/android/app/Activity.html#onDestroy%28%29
https://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html
Take a look at:
http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#pause
or
you could send a heartbeat every ~30 seconds via js and ajax.
However, those aren't the best methods.
Looks like you'll have to write some native code for both platforms, shouldn't be that hard.
http://developer.android.com/reference/android/app/Activity.html#onDestroy%28%29
https://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html