Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for notification badges on iOS and Android? #81

Closed
JacobHK opened this issue Jul 17, 2018 · 2 comments
Closed

Support for notification badges on iOS and Android? #81

JacobHK opened this issue Jul 17, 2018 · 2 comments

Comments

@JacobHK
Copy link

JacobHK commented Jul 17, 2018

Do you plan to support app icon notification badges for iOS and Android? :)

Or maybe I just overlooked the functionality in the current plugin. Anyhow, would love to see the feature built in.

My use case is simple for a start - when a user gets pushed a notification (scheduled) an app icon badge gets applied. A low-level starting scenario could be binary - either the badge is shown with a "1" on it no matter how many notifications have been pushed since their last open or it's not there at all.
Once the user opens either the notification or the app itself, simply expose a function to clear the badge.

Otherwise, loving the package. So awesome work 👍

@MaikuB
Copy link
Owner

MaikuB commented Jul 17, 2018

Hey there, thanks for your kind words :)
Saw an article on how your app moved from React Native to Flutter too and it looks really good so nice work there!

If you read this link, you'll see that badges are handled in Android 8.0+ out of the box already. There's no functionality for doing this on older versions of Android. If you'd seen badge numbers before on older devices then that was because companies like Sony, Samsung etc had customised their version of Android so they could show it. I could expose some of the features in the aforementioned link though.

On iOS, managing the badge number is a separate issue that isn't actually tied to displaying notifications. Updating the number is actually via this property exposed by the application. As such, I'm not looking to add this given they're independent of each other and starts to deal with app-specific (e.g. another app may want to decrement the number on tapping one notification) and platform-specific problems.

Having said that, there's already a plugin to modify the badge here as well that you should check. Once the Flutter team has pushed the changes for headless Dart execution, the plan is to see if I can use that to expose a callback on when a notification is shown (#21). Assuming that's done, you could use the callback with that plugin to modify the badge number.

I don't know when their PRs will go through though and given your app is dealing with custom logic (i.e. solve an app-specific problem), you might also need look at to rolling your own code for displaying notifications (e.g. by using the code for this plugin as a base and incorporating it directly in your app as opposed to referencing the plugin) and updating the badge when appropriate.

@JacobHK
Copy link
Author

JacobHK commented Jul 17, 2018

Oh, thanks a lot :)

Yeah, been tracking the other issues also. Was mostly wanting to hear if you were looking to implement similar functionality as the current badge plugin, once the PR's come in for headerless Dart. The issue with the current badge plugin is setting the badge without the callback function once a scheduled notification is triggered as you're mentioning yourself.

My conclusion is most likely to do a custom build, but was just looking to hear what your own scoped plan for this plugin was. Anyhow I think I can project where you're looking to draw the line with this plugin. As such feel free to close the issue - and keep up the great work! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants