API: Advertise Device as iBeacon

Kiosk Pro’s iBeacon advertising integration allows you to advertise your device as an iBeacon while also displaying content for visitor use. 

This makes it possible for the app to support contextual, location-aware experiences through another app on a visitor’s personal device or through Kiosk Pro on another iPad without requiring additional iBeacon hardware. 

Note that Kiosk Pro can also trigger navigation or actions based on the presence of external iBeacons - more information on this functionality here

Requirements

Kiosk Pro Enterprise

  • 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
    • Location > iBeacon > Advertise = On JavaScript API Call & UUID, Major Value, Minor Value configured
  • iOS/iPadOS Permissions
    • Bluetooth - more on enabling specific iOS/iPadOS permissions here


Triggers via API Functions

Start Advertising

This function initiates advertising for the device as an iBeacon using the identifiers configured in Kiosk Pro's settings.

Format
kp_iBeaconAPI_startAdvertising();
		
Triggers If the call is successful, the app will immediately call kp_iBeaconAPI_didStartAdvertising. If the call fails, the app will immediately call kp_iBeaconAPI_didFailStartAdvertising.


Stop Advertising

This function ends advertising for the device as an iBeacon.

Format
kp_iBeaconAPI_stopAdvertising();
		
Triggers If the call is successful, the app will immediately call kp_iBeaconAPI_didStopAdvertising. If the call fails, the app will immediately call kp_iBeaconAPI_didFailStopAdvertising.


Notifications via API Callbacks

On Advertising Start

This callback is triggered when the device successfully starts advertising as an iBeacon.

Format
kp_iBeaconAPI_didStartAdvertising(UUID, majorValue, minorValue,  identifier, sessionAlreadyInProgress);
		
Return values
  • UUID - [string] the UUID identifier configured for advertising
  • majorValue - [string] the major value identifier configured for advertising
  • minorValue - [string] the minor value identifier configured for advertising
  • identifier - [string] the identifier identifier configured for advertising
  • sessionAlreadyInProgress - [boolean integer] defining if the device is already advertising. Possible values are:
    • 0 = false
    • 1 = true


On Failure to Start Advertising

This callback is triggered when the device fails to start advertising as an iBeacon.

Format
kp_iBeaconAPI_didFailStartAdvertising(UUID, majorValue, minorValue, identifier, error);
		
Return values
  • UUID - [string] the UUID identifier configured for advertising
  • majorValue - [string] the major value identifier configured for advertising
  • minorValue - [string] the minor value identifier configured for advertising
  • identifier - [string] the identifier identifier configured for advertising
  • error - [array] if defined, the function was unable to successfully start advertising. Formatted as an associative array of key-value pairs with the following keys:
    • domain
    • code
    • description
    • failureReason
    • recoverySuggestion
    • debugDescription


On Advertising Stop

This callback is triggered when the device stops advertising as an iBeacon.

Format
kp_iBeaconAPI_didStopAdvertising(UUID, majorValue, minorValue, identifier);
		
Return values
  • UUID - [string] the UUID identifier configured for advertising
  • majorValue - [string] the major value identifier configured for advertising
  • minorValue - [string] the minor value identifier configured for advertising
  • identifier - [string] the identifier identifier configured for advertising


On Failure to Stop Advertising

This callback is triggered when the device is unable to stop advertising as an iBeacon.

Format
kp_iBeaconAPI_didFailStopAdvertising(UUID, majorValue, minorValue, identifier, error);
		
Return values
  • UUID - [string] the UUID identifier configured for advertising
  • majorValue - [string] the major value identifier configured for advertising
  • minorValue - [string] the minor value identifier configured for advertising
  • identifier - [string] the identifier identifier configured for advertising
  • error - [array] if defined, the function was unable to successfully stop advertising. Formatted as an associative array of key-value pairs with the following keys:
    • domain
    • code
    • description
    • failureReason
    • recoverySuggestion
    • debugDescription


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 kioskgroup.com/ibeacon-advertising-api
  • To download a .zip of sample code, click here.

Change Log

  • Added in version 8.5

Still stuck? How can we help? How can we help?