Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2693] Add background cleanup handlers for termination/suspend

GitHub Issuen/a
Resolution Date2013-11-12T21:50:50.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M04
Labelsbackground, cleanup, defect, ios, release-1.6.0
ReporterStephen Tramer
AssigneeStephen Tramer


It looks like there are points in shutdown/suspend where we need to ensure that certain operations are completed (such as user-defined callbacks, analytics, etc.) We need to ensure that all of these are done before suspend/termination is complete on iOS 4.0+. In particular, see the comment on this commit: https://github.com/appcelerator/titanium_mobile/commit/3165d74ad25b899f6d820b2ca76352fe13d9001a


  1. Stephen Tramer 2011-04-15

    Termination is still on a 5s countdown. From the Apple documentation: "However, if your application is currently running in the background state (in other words, not suspended), the system calls the applicationWillTerminate: method of your application delegate. *Your application cannot request additional background execution time from this method.* Otherwise, analytics events which are queued now have their dispatch completed before shutdown."
  2. Jeff Haynie 2011-04-15

    (from [0a81aa09fe73b5261b897390ee99b11f824a6498]) [#2693 state:fixed-in-qa] Background execution support for analytics. No other BG handlers appear to be needed at this time. https://github.com/appcelerator/titanium_mobile/commit/0a81aa09fe73b5261b897390ee99b11f824a6498"> https://github.com/appcelerator/titanium_mobile/commit/0a81aa09fe73...

  3. Stephen Tramer 2011-04-15

    To test this bug:

    Start KS

    Repeatedly FG/BG the app as quickly as possible

    Watch analytics output; you should be seeing analytics events sent from the background (the reachability status info in the log is a good indicator this is happening).

  4. Alan Leard 2011-04-15

    Successful iPhone and iPad test on 01/28/2011

    • iPhone Results: [INFO] app was paused from the foreground, [INFO] app is resuming from the background, [DEBUG] Reachability Flag Status Change: -R -----l- networkStatusForFlags
    • iPad Results: [DEBUG] Reachability Flag Status Change: -R -----l- networkStatusForFlags

    Mobile SDK version: 1.6.0 (01/26/11 18:53 bd12917...)

    iPhone Version: iPhone 4 / 4.2.1

    iPad Version: 4.2.1

JSON Source