API: Navigate or Trigger Action Based on iBeacon Proximity
Create a location-aware interactive presentation by displaying specific content based on the device's proximity to an iBeacon. iBeacon is a Bluetooth advertising protocol designed by Apple with native support in iOS and iPadOS.
This functionality is useful for deployments where devices are distributed to visitors, like a multimedia tour of a museum.
Note that Kiosk Pro can also advertise as an iBeacon itself - more information on this functionality here.
In this article
Requirements
- Integration of our JavaScript API into your webpage
- Sample code to run within the app and download for integration into your own project is available here.
- Best practices for working with the JavaScript API are available here.
- App Settings
- Content > JavaScript API > Access JavaScript API = By Import
- iOS/iPadOS Permissions
- Bluetooth & Location - more on enabling specific iOS/iPadOS permissions here.
- Physical Hardware
- iBeacon-enabled hardware.
Triggers via API Functions
Start Monitoring for iBeacons
This function starts monitoring for iBeacons. This function must also define a filepath to the schema file that instructs Kiosk Pro on how to respond to specific beacons.
Format | kp_iBeaconAPI_startMonitoringWithPath2SchemeFile(filepath); |
Parameters | |
Triggers | If Kiosk Pro is unable tp find or parse the .xml file, the app will immediately call kp_iBeaconAPI_didFailMonitoringWithError, passing more detail about the error as a parameter. |
Stop Monitoring for iBeacons
This function ends monitoring for iBeacons.
Format | kp_iBeaconAPI_startMonitoringWithPath2SchemeFile(filepath); |
Parameters | |
Triggers | If Kiosk Pro is unable tp find or parse the .xml file, the app will immediately call kp_iBeaconAPI_didFailMonitoringWithError, passing more detail about the error as a parameter. |
Notifications via API Callbacks
When Device Enters a Beacon Region
This callback is run each time the device enters a new iBeacon region defined in the current schema file.
Format | function(callback); |
Return values |
|
When Device Leaves a Beacon Region
This callback triggers each time the device exits an iBeacon region defined in the current schema file.
Format | kp_iBeaconAPI_didExitBeaconRegion(UUID, majorValue, minorValue, name); |
Return values |
|
When Monitoring for Beacons Returns an Error
This callback triggers when the function to initiate monitoring using kp_iBeaconAPI_startMonitoringWithPath2SchemeFile is unsuccessful.
Format | kp_iBeaconAPI_didFailMonitoringWithError(error); |
Return values |
|
Sample Code
- This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
- To run sample code, set the app's homepage to https://kioskgroup.com/ibeacon-navigation-api
- To download a .zip of sample code, click here.
Change Log
- Added in version 8.5.