【发布时间】:2018-06-10 15:09:11
【问题描述】:
我将 NotificationCompat.Builder 设置为:
.setSound(getNotificationSound(), AudioManager.STREAM_ALARM)
.setCategory(NotificationCompat.CATEGORY_ALARM)
.setPriority(NotificationCompat.PRIORITY_MAX)
在其他强制性属性中。
对于我正在使用的 NotificationChannel,我补充说:
.setBypassDnd(true)
对于奥利奥来说,问题在于:
- 当手机静音或振动时,触发的通知没有任何声音,因此它不会像闹钟一样发挥作用
通知类别/频道中的请勿打扰自定义异常切换按钮有什么意义?因为我没有看到任何差异,它是否有助于实现我的目标?
对于比 Oreo 更早的版本,我没有使用 NotificationChannel,我有一个我更喜欢的行为:
- 当手机静音但没有振动时,通知声音有效
- 通知声音和振动在手机处于振动状态或启用声音时起作用
任何想法如何解决这种不一致?
【问题讨论】:
标签: android notifications android-notifications android-alarms notification-channel