Is it possible using the Mobile SDK (specifically hybrid apps) to continue to run in the background? I believe there are cordova plugins for this but will they work with the Mobile SDK?
1 Answer
Yes, but there's nothing here specific to hybrid (vs. native) and you can call these native APIs with Cordova as normal. Hybrid, as always, excels at write-once-suck-everywhere. :)
iOS apps have limited execution time available when they move to the background. You should check the UIApplication
documentation and pay special attention to properties like backgroundTimeRemaining
and methods like beginBackgroundTaskWithExpirationHandler:
as well as the background app refresh bits that are new with iOS 7.
In general, you cannot predict in advance how much time your app will have to execute once it moves to the background. Some factors that come into play are the device's hardware, current memory pressure, and what the device is currently doing in the foreground (the user switching to a game, for example, is more likely to cause iOS to terminate background processes). The system will also terminate your app if you exceed your background processing time.