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 app badges on more platforms #2480

Open
Levi-Lesches opened this issue Dec 2, 2024 · 4 comments
Open

☂️ Support app badges on more platforms #2480

Levi-Lesches opened this issue Dec 2, 2024 · 4 comments

Comments

@Levi-Lesches
Copy link
Contributor

Levi-Lesches commented Dec 2, 2024

@BluePalmTree
Copy link

Could you maybe give a small example on how you implemented the badge numbers on Android & iOS?

@Levi-Lesches
Copy link
Contributor Author

Sure (note, I didn't write the Android and iOS implementations):

Android

if (notificationDetails.number != null) {
builder.setNumber(notificationDetails.number);
}

iOS/MacOS

if ([self containsKey:BADGE_NUMBER forDictionary:platformSpecifics]) {
content.badge = [platformSpecifics objectForKey:BADGE_NUMBER];
}

@MaikuB
Copy link
Owner

MaikuB commented Dec 10, 2024

docs: the readme points to a deprecated package and says that this plugin cannot provide bags numbers when it in fact can on Android and iOS

Although a typical use case is to have it tied to notifications, note that what is mentioned in the docs was specifically referring to app badging that can also be done without notifications. This is why I mentioned "directly"

On Android, this refers to how there's no official Android API for this at an app level. If you looked into the discontinued plugin, it makes use of a popular library in the Android ecosystem where there are various launchers that allow seeing and setting the badge count. This looks different to what can be seen on stock Android where there isn't a number in the corner of the app icon. I use to have a Sony phone where I noticed badge numbers but this was prior to working on this plugin. I don't know if it'll respect what's passed through the notification. Might need to get help from others and also check other phones that I can borrow to confirm.

On iOS/macOS, this was referring to https://developer.apple.com/documentation/uikit/uiapplication/applicationiconbadgenumber. It wasn't deprecated at the time and looks like it's only been recently been considered as deprecated with the docs mentioning to use this instead

@Levi-Lesches
Copy link
Contributor Author

If you looked into the discontinued plugin, it makes use of a popular library in the Android ecosystem where there are various launchers that allow seeing and setting the badge count.

...Interesting. I didn't even think to go the Linux way of "better support every combo that exists" and thought the base Android sdk would be enough. I think it's reasonable that badges without a notification aren't implemented yet, and if we do find a replacement, we can always add it to the Android plugin.

Still, probably worth clarifying the distinction in the docs. I have a PR for that but so far I've only done the native setup docs, not the list of features the plugin supports

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

3 participants