The Vibration API is exposed at
Vibration.vibrate(). The vibration is synchronous so this method will return immediately.
There will be no effect on devices that do not support Vibration, eg. the simulator.
Note for Android: add
<uses-permission android:name="android.permission.VIBRATE"/> to
The vibration duration in iOS is not configurable, so there are some differences with Android. In Android, if
pattern is a number, it specifies the vibration duration in ms. If
pattern is an array, those odd indices are the vibration duration, while the even ones are the separation time.
In iOS, invoking
vibrate(duration) will ignore the duration and vibrate for a fixed time. While the
pattern array is used to define the duration between each vibration. See below example for more.
Repeatable vibration is also supported, the vibration will repeat with defined pattern until
cancel() is called.
Trigger a vibration with specified
|pattern||number or ||Yes||Vibration pattern, accept a number or an array of numbers. Default to 400ms.|
|repeat||boolean||No||Repeat vibration pattern until cancel(), default to false.|