In our earlier chapters, we looked at enabling background location through the UIBackgroundModes
key in the Info.plist
file of our application. Let's look deeper into how background processing for our applications works. Background execution of the code is possible through the implementation of multitasking in iOS.
Why is background code execution needed? Let's take up a scenario. You are a frequent visitor to restaurants or bars, and you are interested in getting the best deals of such venues nearby. Now, if you were using a regular application that showed you nearby places having discount, for say a Pizza meal, you would have to fire the app, hit the search button, and then locate the closest venue. What if the app does it all for you, so that as you move from your home location to say four blocks away, the application automatically calculates your latest position, and based on your preferences, it can show you an alert for nearby deals at restaurants and bars...