Don't set notification sound/vibration/light on Android 8+
On Android 8+ these values should be ignored anyway. But on some devices setting a notification sound could lead to a SecurityException (when the app doesn't have permission to access the notification sound URI).
@@ -2,6 +2,7 @@ package com.fsck.k9.notification
import android.content.Context
import android.net.Uri
+import android.os.Build
import android.text.TextUtils
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
@@ -90,7 +91,7 @@ internal fun NotificationCompat.Builder.setAppearance(
): NotificationCompat.Builder = apply {
if (silent) {
setSilent(true)
- } else {
+ } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
if (!appearance.ringtone.isNullOrEmpty()) {
setSound(Uri.parse(appearance.ringtone))
}
