Add missing permission checks for notifications
Notifications can be disabled manually even after permission has been granted once. Always check if they are enabled before notifying the user. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
parent
89cb87b2a9
commit
582f852e7a
6 changed files with 38 additions and 15 deletions
|
|
@ -72,7 +72,9 @@ public final class NotificationUtil {
|
|||
notificationBuilder = createNotification();
|
||||
}
|
||||
updateNotification();
|
||||
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
|
||||
if (notificationManager.areNotificationsEnabled()) {
|
||||
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void updateThumbnail() {
|
||||
|
|
@ -84,7 +86,9 @@ public final class NotificationUtil {
|
|||
}
|
||||
|
||||
setLargeIcon(notificationBuilder);
|
||||
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
|
||||
if (notificationManager.areNotificationsEnabled()) {
|
||||
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue