简体   繁体   English

建议的通知振动持续时间?

[英]Recommended notification vibration duration?

What is the recommended notification vibration duration in Android? Android中建议的通知振动持续时间是多少? Here's my current code which makes a notification vibrate for 1000ms 这是我当前的代码,它使通知振动1000ms

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

Is there something like notificationBuilder.setVibrate("default_time"); 是否有诸如notificationBuilder.setVibrate("default_time");

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM