Vibration
Vibrates the device.
Example
Android apps should request the
android.permission.VIBRATE
permission by adding<uses-permission android:name="android.permission.VIBRATE"/>
toAndroidManifest.xml
.
The Vibration API is implemented as a
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
call on iOS.
Reference
Methods
cancel()
static cancel();
Call this to stop vibrating after having invoked vibrate()
with repetition enabled.
vibrate()
static vibrate(
pattern?: number | number[],
repeat?: boolean
);
Triggers a vibration with a fixed duration.
pattern
argument.
The vibrate()
method can take a pattern
argument with an array of numbers that represent time in milliseconds. You may set repeat
to true to run through the vibration pattern in a loop until cancel()
is called.
pattern
array represent the vibration duration, while the even ones represent the separation time. pattern
array represent the separation time, as the vibration duration is fixed.
Name | Type | Default | Description |
---|---|---|---|
pattern | number Android array of numbers | 400 | Vibration duration in milliseconds. Vibration pattern as an array of numbers in milliseconds. |
repeat | boolean | false | Repeat vibration pattern until cancel() . |