Apache Cordova | Phonegap vibrate plugin tutorial

Apache cordova / phonegap vibrate plugin api is used for vibrating you mobile devices. using this plugin use can vibrate your mobile single time (or) multiple time with time interval. To use this vibration feature of the phonegap application you have to add vibration plugin with your phonegap project. you can also refer Phonegap Cheatsheet for plugins or continue read with phonegap vibrate plugin tutorial

phonegap vibrate plugin installation

cordova plugin add org.apache.cordova.vibration

phonegap vibrate plugin Methods

navigator.vibrate(time) or navigator.vibrate([time])
navigator.vibrate(3000) or navigator.vibrate([3000])

where time referred as milliseconds, for vibrating your mobile as series, you can use array like navigator.vibrate([3000,1000,2000]) which vibrate your phone 3 seconds and wait for one second and vibrate 2 seconds

phonegap vibrate plugin example

function vibrateOnce(){
function vibrateSeries(){
<button onclick="vibrateOnce()">Vibrate Once</button>
<button onclick="vibrateSeries()">Vibrate Series</button>

Note: ** Series vibration may not works with ios platform

For documentation you can refer http://plugins.cordova.io/#/package/org.apache.cordova.vibration