com.kony.PeripheralManager

A Peripheral Manager object is used to manage published services within the local peripheral device’s Generic Attribute Profile (GATT) database and to advertise these services to central devices. If a service is in the database, it is visible and can be accessed by any connected central. If your application does not have the specified Bluetooth-peripheral background mode, the contents of its services become disabled when it is in the background or in a suspended state. Any remote central trying to access the service’s characteristic value or characteristic descriptors receives an error.

Before you call Peripheral Manager methods, the state of the peripheral manager object must be powered ON, as indicated by the PeripheralManagerStatePoweredOn. This state indicates that the peripheral device (for example, your iPhone or iPad) supports Bluetooth low energy, and Bluetooth is switched ON and available to use. Peripheral Manager is used for turning iOS device into iBeacon.

The com.kony.PeripheralManager class has the following methods:

Here is an example to create a new Peripheral Manager object.

var BeaconRegion1= new com.kony.PeripheralManager();

Here is an example to create a PeripheralManager with callbacks:

var peripheralManager = new com.kony.PeripheralManager(stateUpdatedCallback,advertisingStatusCallback);

Input Parameters

Parameter Description
stateUpdatedCallback [Function] - Optional

To get updated callback state from the Peripheral Manager

  • peripheralManagerState [String ] - Can represent one of the following values: 
    • PeripheralManagerStatePoweredOff - Indicates Bluetooth is currently powered off.
    • PeripheralManagerStatePoweredOn - Indicates Bluetooth is currently powered on.
    • PeripheralManagerStateResetting - The connection with the system service was momentarily lost. An update will occur.
    • PeripheralManagerStateUnauthorized - The app is not authorized to use the Bluetooth low energy peripheral or server role.
    • PeripheralManagerStateUnknown - The current state of the peripheral manager is unknown. An update will occur.
    • PeripheralManagerStateUnsupported - The platform does not support the Bluetooth low energy peripheral or server role.

    function stateUpdatedCallback (peripheralManagerState){}

advertisingStatusCallback [Function] - Optional To get the status callback of advertising from the Peripheral Manager.
  • errorName [String] - Name of the error if error occurrs, null otherwise.
  • errorInfo [Object] - Information about the error if error occurs, null otherwise.

function advertisingStatusCallback (errorName, errorInfo){}

Return Values

Object - com.kony.PeripheralManager

Platform Availability

  • iOS

Methods

The com.kony.PeripheralManager class has the following methods: