Location Services authorization for iBeacon on iOS - Whitelotus Corporation

Location Services authorization for iBeacon on iOS

This post was written by wlcglobal

With iOS 8, Apple introduced changes with its Location Services authorization model. Beacon enabled applications no more oblige the Background App Refresh, however they have to request one of the permission types to get to area information. Those progressions influence each iPhone application development utilizing iBeacon.

Location Services permissions:

  • always authorization – the app can access location data when it’s visible on screen, but is also given access to a certain subset of these when in the background or even when terminated
  • when in use authorization – the app can access location data only when it’s visible on screen
  • denied – the app can’t access location data at all

How does it affect Ranging and Monitoring?

With dependably approval, you can utilize Ranging in the foreground area and region Monitoring when in the foreground and background. Regardless of the fact that your application is killed while observing, despite everything it’ll be relaunched by iOS to handle approaching checking events.

With when in use authorization, you can use Ranging in the foreground, but you won’t be able to start Monitoring at all – not even in the foreground!

When denied access to Location Services, your app won’t be able to range or monitor for beacons.

What does all of this mean for my app?

In order to use Ranging and Monitoring, you need to obtain appropriate permission to access Location Services – when in use for Ranging and always for Monitoring.

Add a mandatory description of how your app uses Location Services

You can do that by navigating to your Info.plist file in the Project Navigator (it’s in the Supporting Files directory), right-clicking on it and selecting Open As – Source Code, and adding the following code just before the </dict> line:

For when in use authorization:

<key>NSLocationWhenInUse UsageDescription</key>

<string>This application uses your location to determine which table you’re at when ordering your coffee.</string>

For always authorization:

<key>NSLocationAlways UsageDescription</key>

<string>This application monitors your location to show you promotional offers in shops you’re passing by.</string>

Request appropriate permission

Before you start using beacon ranging or monitoring, you’re required to call one of the following

ESTBeaconManager methods:

  • requestWhenInUse Authorization
  • requestAlwaysAuthorization

If your application is doing this for the first time, the user will see a pop-up notification asking them to allow the app to access their location. This pop-up will contain the UsageDescription you provided in the Info.plist file.

Once the user grants or denies the permission, subsequent calls to requestWhenInUse Authorization or requestAlways Authorization will not present any more pop-ups. To change the permission, direct your users to the Settings app. Note that it is still mandatory to call either requestWhenInUse Authorization or requestAlways Authorization before starting Ranging or Monitoring – even if your app was already granted the permission and no pop-up is going to be displayed!

Determine if your app has been granted the requested permission

If your app does not have the appropriate permission to use Ranging or Monitoring, no error will be reported – your ESTBeaconManagerDelegate  will simply not be getting any location updates, such as didRangeBeaconsInRegion or  didEnterRegion.

It’s a good practice to make sure your app was granted necessary permission to use Location Services and modify its behavior if the user chose to deny such access.

You can monitor the authorization status in two ways:

  • By calling the ESTBeaconManager‘s authorizationStatus class method and checking the CLAuthorizationStatus  value returned.
  • By implementing the beaconManager:did ChangeAuthorizationStatus:  delegate method and listening for changes in the authorization status.

How does this affect Estimote SDK?

None of the above applies to Core Bluetooth-based methods. For example, startEstimoteBeacons DiscoveryForRegion is a Core Bluetooth-based scan and does not fall under Location Services authorization model. You can use this scan when your app is in the foreground – and in the background, provided you have the Bluetooth-central background mode enabled.

Whitelotus Corporation is a leading mobile application development Company with extensive skills in iBeacon app development. We have a skilled team of developers who make use of the latest high-tech technologies to provide you with robust solutions, which are aimed at enhancing customer experience and value. The experience, combine with highly specialized skills and state-of-the-art technologies enables us to provide you with the best apps.


WeCreativez WhatsApp Support
Our customer support team is here to answer your questions.
Hi, how can I help?