Browse Source

if(amplitude > 255 || amplitude < 1)

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

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

@@ -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

Loading…
Cancel
Save