Apache Cordova API Documentation

Notification (Vibration)

This plugin provides a way to vibrate the device.

Installation

cordova plugin add org.apache.cordova.vibration

Supported Platforms

  • Amazon Fire OS
  • Android
  • BlackBerry 10
  • Firefox OS
  • iOS
  • Windows Phone 7 and 8

notification.vibrate

Vibrates the device for the specified amount of time.

navigator.notification.vibrate(time)
  • time: Milliseconds to vibrate the device. (Number)

Example

// Vibrate for 2.5 seconds
navigator.notification.vibrate(2500);

iOS Quirks

  • time: Ignores the specified time and vibrates for a pre-set amount of time.

      navigator.notification.vibrate();
      navigator.notification.vibrate(2500);   // 2500 is ignored
    

Last modified: 2014-05-15



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus