Device Feedback

Improve this doc

Plugin that lets you provide haptic or acoustic feedback on Android devices.

Repo: https://github.com/VVelda/device-feedback

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-velda-devicefeedback
    $ npm install --save @ionic-native/device-feedback
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { DeviceFeedback } from '@ionic-native/device-feedback';

constructor(private deviceFeedback: DeviceFeedback) { }

...


this.deviceFeedback.acoustic();

this.deviceFeedback.haptic(0);

this.deviceFeedback.isFeedbackEnabled()
  .then((feedback) => {
    console.log(feedback);
    // {
    //   acoustic: true,
    //   haptic: true
    // }
  });

Instance Members

acoustic()

Provide sound feedback to user, nevertheless respect user’s settings and current active device profile as native feedback do.

haptic(type)

Provide vibrate feedback to user, nevertheless respect user’s tactile feedback setting as native feedback do.

Param Type Details
type Number

Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.

isFeedbackEnabled()

Check if haptic and acoustic feedback is enabled by user settings.

Returns: Promise<any>

API

Native

General