1// Vibrate for 150 milliseconds
2private void shakeItBaby() {
3 if (Build.VERSION.SDK_INT >= 26) {
4 ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(150, VibrationEffect.DEFAULT_AMPLITUDE));
5 } else {
6 ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(150);
7 }
8}
9