[TIMOB-17072] iOS: Send ti.background event while the application is in the background
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-06-04T16:59:01.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.3.0 |
Components | iOS |
Labels | n/a |
Reporter | Neeraj Gupta |
Assignee | Sabil Rahim |
Created | 2014-06-04T16:57:50.000+0000 |
Updated | 2014-06-13T21:47:31.000+0000 |
Description
Native SDK currently sends a ti.background event when the application comes to the foreground again or restarted. This affects the number of active sessions on the dashboard as the server times out these sessions after an hour. We can reduce the timeout but that reduces the time window instead of eliminating it completely.
iOS7 provides a nice background feature that allows an application to make network calls when an application is in the background. We should use this feature to send the ti.background event when the session timeout period expires (currently 30 seconds). Set a 30 second timer (or whatever duration user has specified) and send the events once this timer fires. Remove this timer if the application is foregrounded before the expiry of this timeout.
Please note that Android already implements this feature so this ticket brings iOS7 at par with Android.
TIMOB PR https://github.com/appcelerator/titanium_mobile/pull/5761 https://github.com/appcelerator/titanium_mobile/pull/5760
Verified on: Mac OSX 10.9.3 Appcelerator Studio, build: 3.3.0.201406111952 Titanium SDK, build: 3.3.0.v20140613124912 Titanium CLI, build: 3.3.0-rc Alloy: 1.4.0-rc iOS Device: iPhone 5S (7.1.1) Background event is sent while the application is still backgrounded. Closing.