question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android: Silent error when displaying notification and maximum reached

See original GitHub issue

Depending on the android version there is a maximum number of notifications that can be posted to the device. Sometimes 50 sometimes 24. Some manufacturers can even set a different number.

There is no way to query this value (MAX_PACKAGE_NOTIFICATIONS). An error is thrown natively but is not bubbled up to javascript when awaiting notifee.displayNotification, it fails silently.

Only solution I found so far is to get (await notifee.getDisplayedNotifications()).length; before and after calling displayNotification , then cancel a notification and retry after that.

Would be nice to avoid doing the get before and after and just have an error and handle it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mikehardycommented, Aug 28, 2022

What do you think about posting the notification then post-checking the current displayed list to see if it actually went in? Then our API could at least indicate success or failure? Just brainstorming though, admittedly. Trying to see if there is any signal we could squeeze out

1reaction
mikehardycommented, Aug 27, 2022

Interesting - it is hard to get a stacktrace because the assertion that it “silently throws” is incorrect - there is no throw, so there is no stacktrace. It’s silently dropping them, that’s different. (the link to the source was critical in examining this - thanks)

I’m not sure how to handle this then, other than your method of getting the list first, posting, then checking the list again. That should work but there’s the chance the user interacts with a notification (clearing one or more) or that the app in another thread does something (javascript is not multi-threaded but firebase-android-sdk is and if you receive an FCM with a notification block it may attempt to post). So just doing a count is not sufficient I think

I have not worked in this repo in a while so my memories are growing vague but I think there is the idea of a notification ID, it should be able to verify the specific ID you expect is in the list after posting it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Android Messages Having No Notification Sound
How to fix Android's default Messages app having no notification sound for incoming text messages, even with ringer volume set to maximum.
Read more >
How to Fix Data Warning Issue in Android Phone - YouTube
Remove Data Warning Notification in Android Phone #DataWarning #AndroidPhone #MobileData Facebook Page ...
Read more >
16 Ways to Fix Text Message Notifications Not Working on ...
Facing issues related to the text message notifications on Android? Here are a few ways to fix notifications not working on Android phones....
Read more >
Android notification is not showing - Stack Overflow
Your notification is not showing, because you didn't provide an icon. Even though the SDK documentation doesn't mention it being required, it is ......
Read more >
Control notifications on Android - Google Support
Silent : Your phone won't make a sound or vibrate. But the notification will show up when you swipe down from the top...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found