Browse Source

if(amplitude > 255 || amplitude < 1)

amplitude = VibrationEffect.DEFAULT_AMPLITUDE;
master
Patrick Halboth 3 years ago
parent
commit
5c59f7732e

+ 4
- 1
app/src/main/java/de/edotzlaff/schockwelle/SensorMapsActivity.java View File

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

Loading…
Cancel
Save