1

What is the recommended notification vibration duration in Android? Here's my current code which makes a notification vibrate for 1000ms

notificationBuilder.setVibrate(new long[] {0,1000}); 

Is there something like notificationBuilder.setVibrate("default_time");

  • From what I can see many answers have between 400ms-500ms for a single vibrate, lower if multiple in a row (e.g. 200, 200, 200). https://stackoverflow.com/questions/13950338/how-to-make-an-android-device-vibrate – Dr Ken Reid Aug 11 '17 at 12:27

1 Answers1

0

The default values can be utilized as below -

NotificationCompat.Builder  mBuilder =
            new NotificationCompat.Builder(this);
Notification note = mBuilder.build();
note.defaults |= Notification.DEFAULT_VIBRATE;
note.defaults |= Notification.DEFAULT_SOUND;

or you can also do

mBuilder.setDefaults(DEFAULT_SOUND | DEFAULT_VIBRATE | DEFAULT_LIGHTS);
Kapil G
  • 4,081
  • 2
  • 20
  • 32