The Haptics API provides physical feedback to the user through touch or vibration.
To use vibration, you must add this permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.VIBRATE" />import { Plugins, HapticsImpactStyle } from '@capacitor/core';
const { Haptics } = Plugins;
export class HapticsExample {
  hapticsImpact(style = HapticsImpactStyle.Heavy) {
    Haptics.impact({
      style: style,
    });
  }
  hapticsImpactMedium(style) {
    this.hapticsImpact(HapticsImpactStyle.Medium);
  }
  hapticsImpactLight(style) {
    this.hapticsImpact(HapticsImpactStyle.Light);
  }
  hapticsVibrate() {
    Haptics.vibrate();
  }
  hapticsSelectionStart() {
    Haptics.selectionStart();
  }
  hapticsSelectionChanged() {
    Haptics.selectionChanged();
  }
  hapticsSelectionEnd() {
    Haptics.selectionEnd();
  }
}impact(options: HapticsImpactOptions) => void
Trigger a haptics “impact” feedback
| Param | Type | 
|---|---|
options | 
HapticsImpactOptions | 
notification(options: HapticsNotificationOptions) => void Trigger a haptics “notification” feedback
| Param | Type | 
|---|---|
options | 
HapticsNotificationOptions | 
vibrate() => void
Vibrate the device
selectionStart() => void
Trigger a selection started haptic hint
selectionChanged() => void
Trigger a selection changed haptic hint. If a selection was started already, this will cause the device to provide haptic feedback
selectionEnd() => void
If selectionStart() was called, selectionEnd() ends the selection. For example, call this when a user has lifted their finger from a control
| Prop | Type | 
|---|---|
style | 
HapticsImpactStyle | 
| Prop | Type | 
|---|---|
type | 
HapticsNotificationType | 
| Members | Value | 
|---|---|
Heavy | 
"HEAVY" | 
Medium | 
"MEDIUM" | 
Light | 
"LIGHT" | 
| Members | Value | 
|---|---|
SUCCESS | 
"SUCCESS" | 
WARNING | 
"WARNING" | 
ERROR | 
"ERROR" |