/* * 根据客户设置是否震动 * private Vibrator vibrator; * vibrator = (Vibrator) getSystemService(Service.VIBRATOR_SERVICE); * PublicUtil.vibrator(this, vibrator);* / public static void vibrator(Context context, Vibrator vibrator) { SharedPreferences preferences = context.getSharedPreferences( SYSTEM_SETTINGS, Context.MODE_PRIVATE); boolean openVibrator = preferences.getBoolean("openVibrate", true); if (!openVibrator) return; vibrator.vibrate(500);//震动0.5s }
?