Preface

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:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

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.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Warning

This element indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Building Applications with iBeacon by Matthew S. Gast (O’Reilly). Copyright 2015 Matthew S. Gast, 978-1-4919-0457-2.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/building_apps_w_ibeacon.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Writing a book is a collborative effort between author and editor. In many cases (including this book), it is unlikely that I would have finished the book as quickly without the persistence and drive of my editor, in this case Brian Sawyer. Brian helped the project in many ways, and the comparison of location and proximity benefited especially from his assistance.

One of the many reasons that writing for O’Reilly is worthwhile is the ease with which we can call on other experts in the field to participate in the technical review. My review team consisted of Doug Thompson, proprietor of the BEEKn blog; Carles Cufí, an engineer with Nordic Semiconductor; and Robert Davidson of Ambient Sensors. Doug brought his wide-ranging expertise and keen understanding of the market to bear. Carles and Robert are both highly experienced engineers with a deep understanding of Bluetooth, and they helped the book more clearly ground iBeacon firmly within the Bluetooth ecosystem. Naturally, any errors that remain in the book are my own and in no way reflect on the review team.

I am indebted to several people in the industry whom I met while writing the book and who graciously offered their assistance. I first met David Helms, the chief product officer at Radius Networks, when I was in Washington, DC, for a business trip and attended an iBeacon meetup. Over the next several months, David was a wonderful resource who was always willing to talk about industry developments. Our conversations were consistently inspiring and informative, and they helped this book in more ways than I can count. Trung Nguyen and Chi-Lang Ngo, both at Passforce, showed me great hospitality when I visited them in London and had a series of great conversations about how iBeacons worked within the Passbook ecosystem.

Get Building Applications with iBeacon now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.