kony.haptics Namespace
The kony.haptics namespace, which is a part of the Core Haptics API, contains the following API elements.
kony.haptics.HapticsObj Object
The kony.haptics.HapticsObj namespace contains the following functions that allow you to perform custom haptics. You can create a haptics object to represent haptics for specific widgets, callbacks, and also perform operations on them.
You can create a haptics object for the following widgets:
- Button widget
- Group widgets (RadioButtonGroup, CheckBoxGroup)
- Segment widget
- TextArea widget
- TextBox widget
An advancedHaptics UI interface has been provided for the following widget-specific events:
- Button widget - Onclick event
- RadioButtonGroup widget - onSelection event
- PickerView widget - onSelection, onDone events
- Segment widget - onRowClick event
- TextArea widget
- TextBox widget

The kony.haptics.HapticsObj.play API generates and performs the customized haptic feedback based on the parameters passed.
Syntax
kony.haptics.HapticsObj.play(Array events);
Input Parameters
An array of events containing the following elements:
Array events: [{
startTime:
type:
duration:
eventParams: [{
parameterID:
parameterValue;
}, ]
}, ]
Parameter | Description |
---|---|
startTime [float] |
The time at which the specified pattern must be started. |
type [Constant] |
The type of haptic event to be performed. Haptic events are of the following two types:
|
duration [real] |
The time period for which the event lasts. NOTE: The duration parameter is only applicable for continuous events. |
eventParams (optional) |
The combination of event parameters determines the character of the haptic event. Event parameters are specified as part of the creation of a hapticEvent, or as part of an event definition in a haptic pattern. |
parameterID |
The parameter ID can be any of the following:
|
Example
var temp = [{
"startTime": 0,
"type": kony.haptics.HAPTIC_TYPE_TRANSIENT,
"duration": 3,
"eventParams": [{
"parameterID": kony.haptics.HAPTIC_INTENSITY,
"parameterValue": 0.6
}, {
"parameterID": kony.haptics.HAPTIC_SHARPNESS,
"parameterValue": 0.2
}]
}];
var obj = new kony.haptics.HapticsObj();
obj.play(temp);
Return Values
Returns a handle to the haptics object that contains the haptic pattern, for successful.
Returns null
, for failure.
Platform Availability
- iOS
Functions

The kony.haptics.isDeviceCompatible API checks if the device is compatible to use core haptics.
Syntax
kony.haptics.isDeviceCompatible();
Input Parameters
None
Example
kony.haptics.isDeviceCompatible();
Return Values
Boolean
Exceptions
None
Platform Availability
- iOS