Answers for "vibrate phone in android studio"

2

how to make phone vibrate android studio

// Vibrate for 150 milliseconds
private void shakeItBaby() {
    if (Build.VERSION.SDK_INT >= 26) {
        ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(150, VibrationEffect.DEFAULT_AMPLITUDE));
    } else {
        ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(150);
    }
}
Posted by: Guest on January-25-2021

Code answers related to "vibrate phone in android studio"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language