How to vibrate device n number of times through programming in android?

Gkapoor picture Gkapoor · May 4, 2011 · Viewed 13.9k times · Source

can anyone tell me how to vibrate same patter 5 times like this my pattern

long[] pattern = { 0, 200, 500 };

i want this pattern to repeat 5 times

Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(pattern , 5);

Answer

Gkapoor picture Gkapoor · May 12, 2011

I found the solution, it was very simple:

long[] pattern = { 0, 100, 500, 100, 500, 100, 500, 100, 500, 100, 500};
vibrator.vibrate(pattern , -1);