Book Image

Learning ibeacon

By : Craig Gilchrist
Book Image

Learning ibeacon

By: Craig Gilchrist

Overview of this book

Table of Contents (16 chapters)
Learning iBeacon
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Handing over responsibility


In iOS, regions (CLBeaconRegion or CLRegion) associated with your app are tracked all the time, including when the app isn't running. If a region boundary is crossed while an app isn't running, the app is relaunched in the background to handle the event.

Similarly, if the app is suspended when the event occurs, it's woken up and given a short amount of time (around 10 seconds) to handle the event.

When necessary, an app can request more background execution time using the beginBackgroundTaskWithExpirationHandler: method of the UIApplication class.

This means that your app can perform a few actions such as showing a local notification or sending an HTTP request (or both), but it can't really perform running actions such as ranging beacons any longer; this is because once your app goes back to sleep, this function is stopped being called.

You can perform longer running actions in the background by turning on the background modes in the Capabilities tab of the application...