How to make the device vibrate when a certain action occurs(success/failed/error events)?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

We have introduced vibration APIs in V8 Service Pack 3.

Vibration APIs enables the application to provide physical feedback to the user by vibrating the device when a certain action occurs.

vibration APIs are available from V8 SP3(8.3.0) onwards.

Please find the vibration APIs details below

1. kony.phone.startVibration(vibrationConfig, repeat) : This api start the vibration

Examples:

//Device will vibrate for 500 milliseconds.

kony.phone.startVibration([{"delay" : 0, "duration" : 500, "amplitude" :250}]);

//Device will vibrate for 100 milliseconds, then pause for 200 milliseconds, and the device will vibrate again for another 300 milliseconds.

var config = [{"delay" : 0, "duration" : 100, "amplitude" : 250},

{"delay" : 200, "duration" : 300, "amplitude" : 150}];

kony.phone.startVibration (config, false);

2. kony.phone.cancelVibration() : This API stops the ongoing vibration pattern on a device. This api is applicable for Android & Windows platforms.

3. kony.phone.hasVibratorSupport() : This API returns whether vibrator is supported on a device. This api is applicable for Android & Windows platforms.

4. kony.phone.performHapticFeedback(hapticFeedbackValue) : This API provides various haptic feedback to users. This api is applicable for iOS only

hapticFeedbackValue [constant] - Indicates the type of haptic feedback. The following are possible values:

0 - kony.hapticFeedback.SUCCESS – This triggers a haptic feedback for a successful event.

1 - kony.hapticFeedback.WARNING - This triggers a haptic feedback representing warning to user.

2 - kony.hapticFeedback.FAILURE – This triggers a haptic feedback for a failure event.

3 - kony.hapticFeedback.LIGHT – This triggers a haptic feedback of light intensity.

4 - kony.hapticFeedback.MEDIUM - This triggers a haptic feedback of medium intensity.

5 - kony.hapticFeedback.HEAVY - This triggers a haptic feedback of heavy intensity.

6 - kony.hapticFeedback.SELECTION – This triggers a haptic feedback representing selection/state change.

Note : For Android, make sure that the VIBRATE permission is defined under the Manifest Properties.

<uses-permission android:name="android.permission.VIBRATE" />

For Windows, Vibration APIs are supported in devices that satisfy below mentioned requirements.

Windows Requirements:

- The device must have vibration hardware.

- Device family(Windows OS build version): Windows 10 Creators Update (introduced v10.0.15063.0) or later.

- API contract: Windows.Foundation.UniversalApiContract (introduced v4) or later.

Please find the usage details, behavior and limitations in documents

startVibration :

http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/Default.htm#kony.phone_functions.htm#kony.phone.startVibration%3FTocPath%3DPhone%2520API%7Ckony.phone%2520Namespace%7CFunctions%7C_____12

cancelVibration :

http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/Default.htm#kony.phone_functions.htm#kony.phone.cancelVibration%3FTocPath%3DPhone%2520API%7Ckony.phone%2520Namespace%7CFunctions%7C_____2

hasVibratorSupport :

http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/Default.htm#kony.phone_functions.htm#kony.phone.hasVibratorSupport%3FTocPath%3DPhone%2520API%7Ckony.phone%2520Namespace%7CFunctions%7C_____6

performHapticFeedback :

http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/Default.htm#kony.phone_functions.htm#kony.phone.performHapticFeedback%3FTocPath%3DPhone%2520API%7Ckony.phone%2520Namespace%7CFunctions%7C_____9