amplitude = VibrationEffect.DEFAULT_AMPLITUDE;master
if(!mDeviceCanVibrate) | if(!mDeviceCanVibrate) | ||||
return; | return; | ||||
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); | Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); | ||||
if (Build.VERSION.SDK_INT >= 26) { | |||||
if(amplitude > 255 || amplitude < 1) | |||||
amplitude = VibrationEffect.DEFAULT_AMPLITUDE; | |||||
if (Build.VERSION.SDK_INT >= 26) { | |||||
if(duration == 0) | if(duration == 0) | ||||
{ | { | ||||
v.cancel(); //stop vibration if still running | v.cancel(); //stop vibration if still running |