What you will learn

This tutorial will teach you how to manage:

  • Location permission
  • Bluetooth permission

Pre-requisites - What you need to get started

Step 1: Clone the sdk-tutorial repository

  • Clone the sdk-tutorial repository
git clone https://github.com/Connecthings/sdk-tutorial.git
  • Open the iOs>beacon>9-Permission>Starter folder

Step 2: Configure the SDK

  • Configure your CocoaPod files and .plist
  • Configure your SDK with:
    • the UUID of your beacon
    • the appropriate Adtag Environment (DEMO / PREPROD / PROD / PROD_US)
    • your SDK credentials
    [[[ATAdtagInitializer sharedInstance] configureUrlType:ATUrlTypeProd andLogin:@"__USER__" andPassword:@"__PSWD__" andCompany:@"__COMPANY__"] synchronize];

If you need more informations, have a look to the 5 minutes quickstart tutorial

Step 3: Check the authorization status

  • Open the ViewController.h file.
  • Add the ATBeaconBleLocationStatusDelegate protocole
@interface ViewController : UIViewController<ATBeaconBleLocationStatusDelegate>
  • Open the ViewController.m file.
  • Implement the ATBeaconBleLocationStatusDelegate method


  • The CBCentralManagerState returns the Bluetooth status.
  • The CLAuthorizationStatus returns the location permission status.
  • Use the information from the delegate to notify the user about activating bluetooth or authorizing location access.

    if(locationStatus==kCLAuthorizationStatusDenied || locationStatus == kCLAuthorizationStatusRestricted){
        _labelStatus.text = NSLocalizedString(@"adtag.warning.Location.status.text", nil);
    }else if (bleStatus== CBCentralManagerStateUnauthorized || bleStatus == CBCentralManagerStatePoweredOff){
        _labelStatus.text = NSLocalizedString(@"adtag.warning.ble.status.text", nil);
    }else if(bleStatus == CBCentralManagerStateUnsupported){
        _labelStatus.text = NSLocalizedString(@"adtag.notsupported.ble.status.text", nil);
         _labelStatus.text = NSLocalizedString(@"adtag.ready", nil);

    [_labelStatus setNeedsDisplay];
  • Register the delegate on the viewDidAppear method
    [super viewDidAppear:animated];
    [[ATBeaconManager sharedInstance] registerAdtagBeaconBleLocationDelegate:self];
  • Unregister the delegate in the viewDidDisappear method
    [super viewDidDisappear:animated];
    [[ATBeaconManager sharedInstance] registerAdtagBeaconBleLocationDelegate:nil];

Step 4: Start testing

  1. In Xcode, click on "Play" to launch the installation process of the application you have just built on your phone

  2. Refuse access to your location

  3. The application displays: "Please authorize the application to access your location".

  4. Deactivate Bluetooth.

  5. The application displays: "Please activate bluetooth".