amplitude = VibrationEffect.DEFAULT_AMPLITUDE;master
@@ -146,8 +146,11 @@ public class SensorMapsActivity extends FragmentActivity implements OnMapReadyCa | |||
if(!mDeviceCanVibrate) | |||
return; | |||
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) | |||
{ | |||
v.cancel(); //stop vibration if still running |