diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java index e352fae1..61125ece 100644 --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -106,6 +106,10 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. @Override public boolean checkRequiredPermissions() { + return hasNotificationsPermission(); + } + + private boolean hasNotificationsPermission() { //Notifications use a different kind of permission, because it was added before the current runtime permissions model String notificationListenerList = Settings.Secure.getString(context.getContentResolver(), "enabled_notification_listeners"); return StringUtils.contains(notificationListenerList, context.getPackageName()); @@ -506,6 +510,9 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. } private void sendCurrentNotifications(NotificationReceiver service) { + if (!hasNotificationsPermission()) { + return; + } StatusBarNotification[] notifications = service.getActiveNotifications(); if (notifications != null) { //Can happen only on API 23 and lower for (StatusBarNotification notification : notifications) {