Answers for "android vibrate device"

0

android vibrate device

import android.os.Vibrator;
...
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
// Vibrate for 500 milliseconds
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    v.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE));
} else {
    //deprecated in API 26 
    v.vibrate(500);
}
Posted by: Guest on August-01-2021

Code answers related to "android vibrate device"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language