开启震动,单次,5秒:
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); //震动5秒 vibrator.vibrate(5000);
权限:
<uses-permission android:name="android.permission.VIBRATE" />
关闭震动,需要调用之前开启的对象的cancel()方法:
vibrator.cancel();