2

I want to Vibrate a phone for long time(e.g 2 minutes) but It vibrates for very less time. i am using this code

Vibrator mVibrate = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
mVibrate.vibrate(2*60*1000); // 2 Minutes

How to vibrate for 2 or 3 minutes ?

Atul Bhardwaj
  • 6,647
  • 5
  • 45
  • 63

1 Answers1

2

There is another way for long viabration as follows,

Vibrator mVibrate = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long pattern[]={0,800,200,1200,300,2000,400,4000};
// 2nd argument is for repetition pass -1 if you do not want to repeat the Vibrate
mVibrate.vibrate(pattern,-1);

You can increase the pattern's array for long time viabration.

Lucifer
  • 29,392
  • 25
  • 90
  • 143