Vibrate Indefinitely
suggest changeUse 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);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents