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
Return Values
Object - com.kony.PeripheralManager
Platform Availability
- iOS
Methods
The com.kony.PeripheralManager
class has the following methods:
The authorization status of an application is managed by the system and determined by several factors. Applications must be clearly authorized to share data using Bluetooth services while in the background state. The system automatically displays a request for user authorization when your app first attempts to use Bluetooth services to share data.
Calling this method does not prompt the user for access. Instead, you can use this method to detect restricted access and simply hide any affected UI features from the user.
Syntax
<<PeripheralObject>>.authorizationStatus();
Input Parameters
None
Example
var authorizationStatus1 = PeripheralManager1.authorizationStatus();
Return Values
String
Returns any one of the following values:
Return Value | Description |
---|---|
PeripheralManagerAuthorizationStatusDetermined |
The user has made a choice regarding whether this application can share data using Bluetooth services while in the background state. |
PeripheralManagerAuthorizationStatusRestricted | This application is not authorized to share data using Bluetooth services while in the background state. The user cannot change this application's status, possibly due to active restrictions such as parental controls. |
PeripheralManagerAuthorizationStatusDenied | The user clearly denied this app from sharing data using Bluetooth services while in the background state. |
PeripheralManagerAuthorizationStatusAuthorized | This application is authorized to share data using Bluetooth services while in the background state. |
Platform Availability
- iOS
To determine if the Peripheral Manager is currently advertising data.
Syntax
<<PeripheralObject>>.isAdvertising();
Input Parameters
None
Example
var isAdvertising1 = PeripheralManager1.isAdvertising();
Return Values
Boolean
Platform Availability
- iOS
Starts advertising beacon data with Measured Power.
Syntax
<<PeripheralObject>>.startAdvertisingWithMeasuredPower();
Input Parameters
Parameter | Description |
---|---|
beaconRegion [Object] - com.kony.BeaconRegion |
A Beacon Region whose data is to be advertised. |
measuredPower [Number] - Optional | The Received Signal Strength Indicator (RSSI) value (measured in decibels) for the device. This value represents the measured strength of the beacon from one meter away and is used during ranging. Specify null to use the default value for the device. |
Example
PeripheralManager1.startAdvertisingWithMeasuredPower(beaconRegion, measuredPower);
Return Values
None
Platform Availability
- iOS
Stops advertising Peripheral Manager data.
Syntax
<<PeripheralObject>>.stopAdvertising() ;
Input Parameters
None
Example
var stopAdvertising1 = PeripheralManager1.stopAdvertising();
Return Values
None
Platform Availability
- iOS