You need to add following permition for enabling vibrate.
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
And for detecting vibrate mode you can use AudioManager's getRingerMode() method
AudioManager audiomanager = (AudioManager)
getSystemService(Context.AUDIO_SERVICE);
switch (audiomanager.getRingerMode()) {
case AudioManager.RINGER_MODE_SILENT:
Log.i("Mode","Silent mode");
break;
case AudioManager.RINGER_MODE_VIBRATE:
Log.i("Mode","Vibrate mode");
break;
case AudioManager.RINGER_MODE_NORMAL:
Log.i("Mode","Normal mode");
break;
}
EDIT
You can check user's vibrate settings of call and notification using following code
Log.i("Setting", ""+audiomanager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER));
Log.i("Setting", ""+audiomanager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION));