The document discusses doing background tasks on iOS, which is limited to a few options. It can explain that apps can register to receive location updates, play audio, or perform VOIP tasks in the background by setting the appropriate value in the app's Info.plist file. The document provides code samples and demos for receiving location updates and playing audio in the background. Developers are warned that background tasks may drain the user's battery.
4. Get Your Notepads
Ready
Suspending vs. Resuming
Local Notifications
Doing Stuff in the Background
5. Exiting vs. Resume
Since iOS 4, you can keep your app
âopenâ on exit
But itâs really just a âfreezeâ and
resume - nothing happens while itâs
in the background
6. Resume Me
Set the âUIApplicationExitsOnSuspendâ
to âNOâ in your Info.plist
13. Local Notifications
You can schedule local notifications
to prompt the user at a future time
even if your app isnât running
Useful - but remember the user isnât
required to open the app, and your
notification may never appear
15. Ok, Next
So you âcanâ do things in the
background, but itâs limited to 3
things:
Get GPS updates
Play Justin Bieber
Do the VOIP
16. Set Your Plist
Do do one of those 3 lovely things in
the background, set the
âUIBackgroundModesâ in your
Info.plist
Values are: location, audio, voip
17. Location
Get super duper real-time updates or
major changes only
Use CLLocationManager to do the magic
22. Fighting the Man
People have tried tricking the system
by playing an âemptyâ sound file.
This works until some other app plays
sound.
GPS Updates take up battery power, so
your users may hate you.
23. Conclusion
Read more at:
http://developer.apple.com/library/ios/
#documentation/iphone/conceptual/
iphoneosprogrammingguide/
BackgroundExecution/
BackgroundExecution.html
Sample Code: https://github.com/
dnstevenson/BackgroundTest
Good Luck!
24. Thanks!
Find me on Twitter @dnstevenson
Buy one of my apps at http://
www.stevensonsoftware.com
Leave me a 5-star review and Iâll be
your best friend