Vibrate Indefinitely

suggest change

Use Vibrator.vibrate(long[], int). The app needs android.permission.VIBRATE. This method is deprecated at API 26 in favor of VibrationEffect. A repeat index of 0 starts again at the beginning of the pattern and continues until cancel().

Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

// Start time delay 
// Vibrate for 500 milliseconds 
// Sleep for 1000 milliseconds 
long[] pattern = {0, 500, 1000};

// 0 meaning is repeat indefinitely 
vibrator.vibrate(pattern, 0);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents