浏览代码

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>

Dariusz Olszewski 3 年之前
父节点
当前提交
4a5f6cf1fe
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java

+ 5 - 0
app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java

@@ -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;