I'm using the AS3 Timer class to sync data between a Flex Mobile app and a server ideally every 30 mins then send a local (distriqt) Notification to the user when action is required.
However, when the device goes into sleep / hibernate mode it seems to slow down, even stop the Timer. I've tried using a lower interval (5mins) but it still only works intermittently.
This is very hard to test as the behavior is different in debug / run modes.
Any suggestions?
Thanks.
Sounds like you might need to change your approach here. Background operation of applications is very different from the foreground.
Your application will run for a little while (depending on the current device memory load among other things) and will then enter a suspended mode, mainly to preserve the application's memory state.
There are some background mode exceptions to this, such as audio playback and location updates, however if you aren't performing these then Apple will most likely reject your application as part of the review process.
You can also investigate the
executeInBackground
flag on theNativeApplication
. This allows a long running task to execute in the background, however this does not guarantee that the application would run in the background continuously.You can read more here: http://blogs.adobe.com/airodynamics/2012/05/04/air-ios-background-behavior/
UIBackgroundModes: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22