Building Applications with iBeacon (2015)
We all carry supercomputers in our pockets. Sometimes we even still make phone calls with them, too. The computing power available in most smartphones today is vastly greater than what many desktop computers had when I started working with computers, and that additional computing power has been put to good use in redefining the way that we interact with the world.
Extending the mobile computing experience beyond the glass touchscreen is a key component of enabling the Internet of Things, developing wearable computers, and embedding intelligence in the world. Humans have sensors (such as eyes!) to interact with the world around us, and phones now have the electronic equivalent by using proximity technology to discover the immediate world around them.
But how can a phone recognize what it is near?
The answer to that question is the essence of proximity and helps move nearby interactions onto the smartphone touchscreen. Getting a basic readout on what is in the neighborhood is the most basic operation for making a phone part of a mobile computing system.
Or, to say it better, knowing what you are near is foundational. Proximity is the “Hello, world” for the Internet of Things.
Many technologies exist to help phones interact with the world around them. This book is about iBeacons, a Bluetooth technology that helps a device understand its location and surroundings with a high degree of accuracy. iBeacons enable a device to display web pages, control nearby machines, and negotiate transactions, all based on being near enough for actions to matter.
Who This Book Is For
This book is intended mainly for application developers. As you’ll see, the protocol is straightforward. The main talent required to successfully use beacons is imagination to see how to apply proximity to the problems your application faces. iBeacons are cheap enough to easily get started with application development, and the cost is low enough that any organization can afford the tiny up front cost. In many cases, it is common to start off with just a single developer investigating the technology.
How to Use This Book
This book is organized into the following chapters:
Chapter 1, Introduction
This chapter introduces the concepts of proximity sensing, which is the core of what beacons enable, and describes sample applications of the technology.
Chapter 2, The iBeacon Protocol
Beacons describe the space around them using a simple protocol. Instead of directly describing the space, a beacon is used as a pointer by an application running on a mobile device to map the physical world containing the beacon into something that the application can act on.
Chapter 3, Setting Up Your Own iBeacons
The beacon protocol is simple enough that it can be implemented straightforwardly in software. Applications can run on a general-purpose operating system such as Mac OS X, free applications on mobile devices, USB dongles, and even special-purpose tiny computers, such as Raspberry Pi or Arduino.
Chapter 4, Application Development
After you have an iBeacon running, an application will watch for it and react to it. To find iBeacons, applications can monitor for transmissions and, once found, can choose to perform ranging operations to determine the distance to an iBeacon. Once identified, applications can also interact with web services or local storage. During the application development process, you will also have to consider the security of the application system from end to end, which might require providing security beyond what is built into the protocol.
Chapter 5, iOS and iBeacons
This chapter describes what is needed to get an application working on iOS. iOS extends the Core Location framework to use iBeacons, which enables developers to activate pre-programmed actions in response to detecting a beacon.
Chapter 6, Building iBeacon Networks
The final step in creating an application is to place beacons in the field to support the application, so that the application works as desired.
Conventions Used in This Book
The following typographical conventions are used in this book:
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
This element signifies a tip or suggestion.
This element signifies a general note.
This element indicates a warning or caution.