do not ignore reminder audio stream settings on Android Oreo

This commit is contained in:
tibbi
2018-07-14 13:54:57 +02:00
parent 9812c079f2
commit cb82bc66f2

View File

@@ -204,13 +204,12 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
config.lastSoundUri = soundUri config.lastSoundUri = soundUri
} }
val channelId = "simple_calendar_${config.lastReminderChannel}" val channelId = "simple_calendar_${config.lastReminderChannel}_${config.reminderAudioStream}"
if (isOreoPlus()) { if (isOreoPlus()) {
val audioAttributes = AudioAttributes.Builder() val audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ALARM) .setUsage(AudioAttributes.USAGE_ALARM)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setLegacyStreamType(config.reminderAudioStream) .setLegacyStreamType(config.reminderAudioStream)
.setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
.build() .build()
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager