NotificationCompat.PRIORITY_DEFAULT 在旧的 OS 版本上没有声音
NotificationCompat.PRIORITY_DEFAULT doesn't make sound on older OS versions
我没有指定任何声音(资源),我想使用默认声音
它在 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)
您尝试过使用 .setDefaults(Notification.DEFAULT_SOUND)
吗?
我没有指定任何声音(资源),我想使用默认声音
它在 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)
您尝试过使用 .setDefaults(Notification.DEFAULT_SOUND)
吗?