问题
I don't specify any sound (resource), I want to use the default sound
It works fine on Android 8 and 9
But on Android 4-7 it triggers notification without sound
How can I make the same behavior on all Android?
Notificaiton builder:
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)
回答1:
Have you tried to use .setDefaults(Notification.DEFAULT_SOUND)
?
来源:https://stackoverflow.com/questions/56407328/notificationcompat-priority-default-doesnt-make-sound-on-older-os-versions