震动手机

/* 
 * 根据客户设置是否震动
 * 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
	}

猜你喜欢

转载自284772894.iteye.com/blog/1807494
今日推荐