0👍
getDeliveredNotifications()
returns only those notifications that have not yet been opened and are still visible in the notification center. Your implementation looks right. It depends on when you call the method.
Get a list of notifications that are visible on the notifications screen.
Source:stackexchange.com