Re: App exit event on ios/android

1,736 views
Skip to first unread message

jcesarmobile

unread,
Dec 14, 2012, 3:04:00 PM12/14/12
to phon...@googlegroups.com
platform?


El jueves, 13 de diciembre de 2012 14:03:14 UTC+1, Rahul Teotia escribió:
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.

Thanks
Rahul 

Rahul Teotia

unread,
Dec 17, 2012, 4:19:58 AM12/17/12
to phon...@googlegroups.com
Both android & ios. 

Rahul Teotia

unread,
Dec 17, 2012, 9:15:22 AM12/17/12
to phon...@googlegroups.com
We tried using window.onunload from phonegap, but it doesn get called in case of shutting down the app from task manager(ios6)
 
you could send a heartbeat every ~30 seconds via js and ajax.

Yeah we thought of it but its not the best solution. 

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

Agreed. We might have to write our own code to support it.  Java might be easier as we came from that background as compare to objective C.

Thanks for your suggestions though


On Sunday, December 16, 2012 2:41:25 PM UTC+5:30, QSDev wrote:
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
Reply all
Reply to author
Forward
0 new messages