Event.DEACTIVATE and application cleanup on iOS
We are developing an Air application which will be deployed first on iPad. We will be using the SQLite database for application state persistance and we do wish to persist user activity right up until application exit. If the Home button is pressed, I've verified that we hear the Event.DEACTIVATE message dispatched on NativeApplication.nativeApplication.
My question is:
1. What guarantees do we have that any cleanup & data persistance code we want to run on Event.DEACTIVATE will actually finish executing? I have tried experiemnts and some simple operations do seem to succeed before deactivation, BUT if I send out an HTTP request, that does not finish executing until I resume the application (my message goes out upon resume). What is the difference, is it the asynchronous nature of the HTTP call? Given that some SQLite operrations are asynchronous, would we run the risk of database corruption if we attempt to persist to it during Event.DEACTIVATE?
2. We actually would like to use the flag UIApplicationExitsOnSuspend to make sure we actually quit between runs. If we use this flag in our app.xml, do we still get the same guarantees during Event.DEACTIVATE to do tombstoning of the application?
Are there any good tech notes on this subject? I have not found any in depth discussion of lifecycle best practice and guarantees for code execution during the suspend phase. (mostly just "listen for Event.DEACTIVATE")
thanks a bunch.