Do not play notification sounds on Oreo or later

On devices with Android 8.0 (Oreo) or later, notification sound will be handled by the system, if notifications have not been disabled by the user.

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
This commit is contained in:
Dariusz Olszewski 2021-11-27 20:42:57 +01:00 committed by Marcel Hibbe
parent 89a8ca630d
commit 4a5f6cf1fe
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -491,6 +491,11 @@ public class NotificationWorker extends Worker {
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
notificationManager.notify(notificationId, notification);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// On devices with Android 8.0 (Oreo) or later, notification sound will be handled by the system
// if notifications have not been disabled by the user.
return;
}
if (!notification.category.equals(Notification.CATEGORY_CALL) || !muteCall) {
String ringtonePreferencesString;