Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Learning ibeacon
Learning ibeacon

Learning ibeacon:

eBook
€8.99 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Learning ibeacon

Chapter 2. Detecting Beacons – Showing an Advert

In the previous chapter, we introduced you to the amazing possibilities of iBeacon and brought the UUID/major/minor broadcasting triplet to your attention. We also built our first, albeit very simple, app that detected the presence of beacons.

In this chapter, we're going to expand our knowledge and get an in-depth understanding of the broadcasting triplet, and we'll expand on some of the important classes within the Core Location framework.

To help demonstrate the more in-depth concepts, we'll build an app that shows different advertisements depending on the major and minor values of the beacon that it detects. We'll be using the context of an imaginary department store called Matey's. Matey's are currently undergoing iBeacon trials in their flagship London store and at the moment are giving offers on their different-themed restaurants and also on their ladies clothing to users who are using their...

Uses of the UUID/major/minor broadcasting triplet

In the last chapter, we covered the reasons behind the broadcasting triplet; we're going to use the triplet with a more realistic scenario. Let's go over the three values again in some more detail.

UUID – Universally Unique Identifier

The UUID is meant to be unique to your app. It can be spoofed, which we'll cover in Chapter 9, iBeacon Security – Understanding the Risks, but generally, your app would be the only app looking for that UUID.

The UUID identifies a region, which is the maximum broadcast range of a beacon from its center point. Think of a region as a circle of broadcast with the beacon in the middle.

If lots of beacons with the same UUID have overlapping broadcasting ranges, then the region is represented by the broadcasting range of all the beacons combined as shown in the following figure. The combined range of all the beacons with the same UUID becomes the region.

UUID – Universally Unique Identifier

Broadcast range

More specifically, the...

Understanding Core Location

The Core Location framework lets you determine the current location or heading associated with the device. The framework has been around since 2008 and was present in iOS 2.0. Up until the release of iOS 7, the framework was only used for geolocation based on GPS coordinates and so was suitable only for outdoor location.

The framework got a new set of classes and new methods were added to the existing classes to accommodate the beacon-based location functionality. Let's explore a few of these classes in more detail.

The CLBeaconRegion class

Geo-fencing (geofencing) is a feature in a software program that uses the global positioning system (GPS) or radio frequency identification (RFID) to define geographical boundaries. A geofence is a virtual barrier.

The CLBeaconRegion class defines a geofenced boundary identified by a UUID and the collective range of all physical beacons with the same UUID. When a device matching the CLBeaconRegion UUID comes in range, the...

Creating a CLLocationManager class

The CLLocationManager class is used to track both geolocation and proximity based on beacons. To start tracking beacon regions using the CLLocationManager class, we need to do the following:

  1. Create an instance of CLLocationManager.
  2. Assign an object conforming to the CLLocationManagerDelegate protocol to the delegate property.
  3. Call the appropriate start method to begin the delivery of events.

All location- and heading-related updates are delivered to the associated delegate object, which is a custom object that you provide.

Defining a CLLocationManager class line by line

Consider the following steps to define a CLLocationManager class line by line:

  1. Every class that needs to be notified about CLLocationManager events needs to first import the Core Location framework (usually in the header file) as shown:
    #import <CoreLocation/CoreLocation.h>
  2. Then, once the framework is imported, the class needs to declare itself as implementing the CLLocationManagerDelegate...

Understanding iBeacon permissions

It's important to understand that apps using the Core Location framework are essentially monitoring location, and therefore, they have to ask the user for their permission. The authorization status of a given application is managed by the system and determined by several factors. Applications must be explicitly authorized to use location services by the user, and the current location services must themselves be enabled for the system. A request for user authorization is displayed automatically when your application first attempts to use location services.

Requesting the location can be a fine balancing act. Asking for permission at a point in an app, when your user wouldn't think it was relevant, makes it more likely that they will decline it. It makes more sense to tell the users why you're requesting their location and why it benefits them before requesting it so as not to scare away your more squeamish users.

Building those kinds of information...

Building the tutorial app

To demonstrate the knowledge gained in this chapter, we're going to build an app for our imaginary department store Matey's. Matey's is trialing iBeacons with their app Matey's offers. People with the app get special offers in store as we explained earlier.

For the app, we're going to start a single view application containing two controllers. The first is the default view controller, which will act as our CLLocationManagerDelegate, the second is a view controller that will be shown modally and shows the details of the offer relating to the beacon we've come into proximity with.

The final thing to consider is that we'll only show each offer once in a session and we can only show an offer if one isn't showing. Shall we begin?

Creating the app

Let's start by firing up Xcode and choosing a new single view application just as we did in the previous chapter. Choose these values for the new project:

  • Product Name: Matey's Offers...

Uses of the UUID/major/minor broadcasting triplet


In the last chapter, we covered the reasons behind the broadcasting triplet; we're going to use the triplet with a more realistic scenario. Let's go over the three values again in some more detail.

UUID – Universally Unique Identifier

The UUID is meant to be unique to your app. It can be spoofed, which we'll cover in Chapter 9, iBeacon Security – Understanding the Risks, but generally, your app would be the only app looking for that UUID.

The UUID identifies a region, which is the maximum broadcast range of a beacon from its center point. Think of a region as a circle of broadcast with the beacon in the middle.

If lots of beacons with the same UUID have overlapping broadcasting ranges, then the region is represented by the broadcasting range of all the beacons combined as shown in the following figure. The combined range of all the beacons with the same UUID becomes the region.

Broadcast range

More specifically, the region is represented by an...

Left arrow icon Right arrow icon

Description

This book is intended for iOS developers who are curious to learn about iBeacon and want to start building applications for iOS. You will gain everything you need to know to master indoor location functionality using Bluetooth beacon technology. No knowledge of iBeacon is assumed.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 25, 2014
Length: 196 pages
Edition : 1st
Language : English
ISBN-13 : 9781784393243
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 25, 2014
Length: 196 pages
Edition : 1st
Language : English
ISBN-13 : 9781784393243
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
Mastering JavaScript Design Patterns
€36.99
Learning ibeacon
€24.99
Swift Essentials
€41.99
Total 103.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. Welcome to iBeacon Chevron down icon Chevron up icon
2. Detecting Beacons – Showing an Advert Chevron down icon Chevron up icon
3. Broadcasting Advertisements – Sending Offers Chevron down icon Chevron up icon
4. Ranging Beacons – Hunting for Treasure Chevron down icon Chevron up icon
5. Detecting Beacons in the Background – Location Dating Chevron down icon Chevron up icon
6. Leaving Regions – Don't Forget Your Stuff Chevron down icon Chevron up icon
7. Vendor SDKs – Buying and Configuring Beacons Chevron down icon Chevron up icon
8. Advanced Tutorial – iBeacon Museum Chevron down icon Chevron up icon
9. iBeacon Security – Understanding the Risks Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(7 Ratings)
5 star 42.9%
4 star 57.1%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Cheopys Feb 09, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A very clear and comprehensive introduction and explanation to this vital new technology. Presentation is staged and linear, examples are clear and useful, not nonsense placeholder code. I'd quibble over the accessibility to novice iOS developers, however. The technology is too dependent on deep understanding of objective C and iOS frameworks for any novice.A singular book, recommended.
Amazon Verified review Amazon
serafino sorleti Jan 27, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Beacon technology was something I was always curious about (both as user and developer), and finally I discovered this book that helped me to understand what a beacon is and how I can use the beacon technology together with iOS SDK to develop either an advertising or a dating or an indoor location or an IoT app. I'm an iOS developer since 2009 and it was very easy for me to understand the author's beacon technology description and how to interact with it using the iOS SDK. Furthermore, the book describes beacons powered apps security issues (and, most important thing, how to solve/minimize these issues). As an iOS developer I really appreciated the good description of background/foreground beacon related location events handling and the OS X companion software that allows book readers to test book objective-c project without the need of buying an actual beacon device (but the author lists the most known beacon devices on the market, their prices, pros and cons of their sdk in a very good and helpful way). Recommended!
Amazon Verified review Amazon
David A. P.A. Jun 30, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book gives you a great walkthrough the ibeacon technology, how to create some apps, important information on security and concerns, if you are a Marketer or a developer its a great option to get into the ibeacon world
Amazon Verified review Amazon
Kevin Kirkhoff Jan 20, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
While I didn’t do all the examples, this book shed a lot of light on the iBeacon technology. Contrary to what the author states early on though, this is not a book for beginners. It’s for intermediate to advanced Objective-C developers who either want to learn iBeacon or they have a project that utilizes it and need a crash course.The author spent a good amount of productive time explaining what iBeacon was and how it can be used. He then jumps into a standard “Hello World” example.The rest of the book is spent on the various concepts…detecting beacons, beacon ranges, advertising beacons, and leaving beacon regions. He even spends some time showing beacon vender SDKs. He ends up the book with some interesting security issues to be aware of.He even has a really cool demo that features beacons in different rooms of a museum.I would highly recommend this book to any experienced Objective-C iOS developers that want to learn (i.e. immerse themselves) in the world of iBeacons.
Amazon Verified review Amazon
James Ransom Jan 13, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This book contains valuable information that is readily available to the reader. It strikes a nice balance of basic knowledge and info pertaining to the technology, as well as delving in deeper for those who are truly serious about getting to know the outs and ins of iBeacon.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.