我没有指定任何声音(资源),我想使用默认声音
在Android 8和9上运行正常
但是在Android 4-7上,它会触发没有声音的通知
如何在所有Android设备上进行相同的行为?
通知生成器:
NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.notify_icon
.setContentTitle(title)
.setContentText(subtitle)
.setPriority(if (Prefs.isNotificationSound) NotificationCompat.PRIORITY_DEFAULT else NotificationCompat.PRIORITY_LOW)
.setCategory(NotificationCompat.CATEGORY_PROMO)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setAutoCancel(true)
答案 0 :(得分:1)
Have you tried to use .setDefaults(Notification.DEFAULT_SOUND)
?