// Java Source Code
Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibe.vibrate(500);
 
// AndroidManifest.xml
<uses-permission android:name="android.permission.VIBRATE"/>