Tuesday, February 04, 2014

Article - Using Background Fetch in iOS

I am super excited to see my latest article published on MobiForge. Here is the abstract:

"In iOS, except for some special cases, an application is not allowed to run in the background. While certainly a serious restriction for some types of application, this feature is designed to conserve battery power. Imagine apps continuing to run in the background without reins, and it is easy to see how the entire system might slow down and deplete the battery within a few hours.

Apple takes a measured approach to background processing. In the early days of the iPhone, after complains from developers about the inability to run apps in the background, Apple introduced the Apple Push Notification service (APNS). APNs allows apps which are not already running to receive background push notifications, thereby allowing apps to be notified when some important events need their attention.

In iOS 7, Apple has introduced another feature to allow apps to run (more or less) in the background – Background Fetch. Background Fetch allows your app to continuously fetch data from the network when it is in the background. As an example, consider the Facebook app. When the Facebook app is in the background, it can continually fetch the latest news feed so that when the user switches the app to the foreground, the latest news feed is already ready for viewing.

In this article we'll take a look to see how background fetch can be used to connect to a Web service, the Open Weather Map API, so that your app can continue to update itself in the background."

No comments: