Geofences and iBeacons

Definition

With Accengage, you are able to trigger notifications based on your users real-time location, as they enter (or exit) a specific zone, even if the application is closed and the device locked.

Real-time notifications based on beacons or geofencing can be setup thanks to Scheduled Alarms or In-App messages within the Accengage dashboard (Actions > Scheduled Alarms (or In-App messages) > Triggers)

In order to benefit from these features, the Accengage library provides two location-aware technologies: Geofences and iBeacons.

To get more information about Geofencing and iBeacons, you can also check out our User Guide.

Permission

Geofencing and Beacons are region-based services. Region monitoring requires the Always Authorization access. For more information, please refer to Apple's documentation.

Disable the SDK from requesting permission for using location services

By default and if needed, when starting one of these services, the library will request permission to use location services. You can prevent the SDK from requesting the needed permission immediately. To do so, call this method before starting the service:

Objective-C:

[BMA4SLocationServices setCanRequestLocationAccess:NO];

Swift:

BMA4SLocationServices.setCanRequestLocationAccess(false);

If you disable the automated authorization request, you will need to call the method requestAlwaysAuthorization manually, otherwise the service will not be started.

Region monitoring (limit the number of regions)

You may also limit the number of regions. You may set it from 0 and up to 20 regions.

Objective-C:

[BMA4SLocationServices setMonitoredRegionCount:0];

Swift:

BMA4SLocationServices.setMonitoredRegionCount(0);

If you don't specify any value, the region count will be set at its maximal value by default (20 regions).

Geofences

Geofencing is particularly easy to set up as there is no hardware deployment required. All you need to do is set geofencing areas, which will trigger a message when your mobile users get in or out, even when the app is closed and the device is locked!

To start the geofencing service call the following method:

Objective-C:

[BMA4SLocationServices setGeofenceServiceEnabled:YES];

Swift:

BMA4SLocationServices.setGeofenceServiceEnabled(true);

iBeacons

The beacon technology enables you to deliver hyper-contextual content based on location, whether it is indoor or outdoor. These small bluetooth proximity sensors communicate with mobile devices to locate users from a few centimeters to a 30-meter radius.

Before using the beacon service, make sure that all of your beacon devices share the same UUID.

Start the beacon service

To start the beacon service call the following method:

Objective-C:

[BMA4SLocationServices setBeaconServiceEnabled:YES];

Swift:

BMA4SLocationServices.setBeaconServiceEnabled(true);

Check device compatibility

Beacon monitoring requires iOS 7 (or a more recent version of iOS) and at least an iPhone 4S, iPod touch (5th generation), iPad (3rd generation or later), or iPad mini.

To check if the user's device can monitor beacons, use the following method:

Objective-C:

[BMA4SLocationServices isBeaconMonitoringAvailible];

Swift:

BMA4SLocationServices.isBeaconMonitoringAvailible();