Vibration:
To work with vibration, we use Vibrator service. Also, we need to use a permission in manifest called VIBRATE.
<uses-permission android:name=”android.permission.VIBRATE”/>
Steps:
1) Get Vibrator system service.
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
2) Call vibrate(milliseconds) method
vibrator.vibrate(3000); // Comes for 3 seconds
For different levels of vibration,
vibrator.vibrate(new long[]{500,200,500,300}, 2);