I am developing an app for iPhone that collects lots of data from vehicles and then uploads it to a remote server. The app itself will be sitting in the vehicle, connected to its battery for power, and collecting data without much user interaction for most of its life. Given that, it is important that these uploads be happening in the background and that the app be "woken up" be the system to do the upload. Also, this is an enterprise app, so the app will NOT need to be put through Apple's approval.
Given these requirements, I had thought that Apple's new iOS 7 background fetch API would be a good solution for my problem. Of course, since I'm not using it entirely as intended, there are some things that could cause some issues for me that I wanted some clarification on.
After watching the WWDC video on the new API, I understand that iOS will attempt to recognize the app's usage patterns and have it woken up only right before it's used. If the app is rarely opened, will that cause it to, eventually, stop doing these background updates?
When I do use this API, the completion handler block I'm given takes a UIBackgroundFetchResult as an argument. If I pass in UIBackgroundFetchResultFailed each time, would that cause iOS to think that I still need that new data and keep waking the app up?
Lastly, since I'm clearly using this API in a different way than it was intended, could someone recommend a better way to do this that would still meet my requirements?
With this given: "app itself will be sitting in the vehicle, connected to its battery for power, and collecting data without much user interaction for most of its life" and "Also, this is an enterprise app, so the app will NOT need to be put through Apple's approval.", why bother with background fetch API at all?
Pick a background mode such as VOIP, and run your task in background mode. Your network connection will stay alive and carrying out any sending/receiving even if screen was locked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With