Я создаю канал с пользовательским звуком. Уведомления отображаются правильно, но воспроизводимый звук по-прежнему используется по умолчанию.
Создание канала
val audioAttribute = AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.build()
val sound = Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
.authority(packageName)
.path(R.raw.notifsound.toString()).build()
alertChannel.apply {
enableVibration(true)
description = "Signal alert channel"
lockscreenVisibility = Notification.VISIBILITY_PUBLIC
setSound(sound, audioAttribute)
}
notificationManager.createNotificationChannels(listOf(locationNotificationChannel,gpsStatusChannel,alertChannel))
Я проверил URI с помощью этого
(contentResolver as ContentResolver).openInputStream(sound)
И он может читать файл.