海水sea 2018-09-14 14:04 采纳率: 0%
浏览 4166

Android O 通知设置提示音

NotificationChannel channel = new NotificationChannel("1","name", NotificationManager.IMPORTANCE_HIGH);
channel.enableVibration(true);
channel.enableLights(true);
channel.setBypassDnd(true);
channel.setShowBadge(true);
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
Notification.Builder builder = new Notification.Builder(this,"1");
builder.setContentTitle("title")
.setContentText("hhhhhhh")
.setSmallIcon(R.mipmap.ic_launcher);
Notification notification = builder.build();
manager.notify(1,notification);

            以上代码创建的通知没有提示音,需要手动打开。有没有什么方法让创建的通知默认有提示音。
  • 写回答

1条回答

  • 硅谷海盗 2019-01-07 20:42
    关注
    channel.setVibrationPattern
    
    
    评论

报告相同问题?