Skip to content

Commit 25c074d

Browse files
committed
getActiveNotifications add in Android 6
1 parent bfbc1e9 commit 25c074d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,13 @@ private static Set<String> findInvalidNotificationIds(Context context, Set<Strin
427427
}
428428
}
429429

430-
StatusBarNotification[] active = getNotificationManager(context).getActiveNotifications();
431-
for (StatusBarNotification notification : active) {
432-
// any notifications in status bar are still valid
433-
String id = String.valueOf(notification.getId());
434-
invalid.remove(id);
430+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
431+
StatusBarNotification[] active = getNotificationManager(context).getActiveNotifications();
432+
for (StatusBarNotification notification : active) {
433+
// any notifications in status bar are still valid
434+
String id = String.valueOf(notification.getId());
435+
invalid.remove(id);
436+
}
435437
}
436438

437439
// if app is launched with notification, user still has access to it

0 commit comments

Comments
 (0)