-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[notifications] badge does not "reset" when calling setBadgeCountAsync(0)
on Android
#29634
Labels
needs review
Issue is ready to be reviewed by a maintainer
Comments
@haileyok Perhaps you might find this helpful or have already seen it, but this is related to #13311 (comment). I had the same issue and had to apply a workaround similar to the comment. |
3 tasks
douglowder
added a commit
that referenced
this issue
Jun 11, 2024
… 0 (#29657) # Why The `ShortcutBadger` package does not correctly set the badge count on Android if the value to be set is 0. This fixes the issue, using a fix provided by @haileyok in #29634 . Fixes #29634. # How In the case where badge count is 0, use Android built in notification manager to cancel all notifications. # Test Plan - CI should pass - API should behave correctly in our test app # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
douglowder
added a commit
that referenced
this issue
Jun 11, 2024
… 0 (#29657) # Why The `ShortcutBadger` package does not correctly set the badge count on Android if the value to be set is 0. This fixes the issue, using a fix provided by @haileyok in #29634 . Fixes #29634. # How In the case where badge count is 0, use Android built in notification manager to cancel all notifications. # Test Plan - CI should pass - API should behave correctly in our test app # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
marklawlor
pushed a commit
that referenced
this issue
Jun 12, 2024
… 0 (#29657) # Why The `ShortcutBadger` package does not correctly set the badge count on Android if the value to be set is 0. This fixes the issue, using a fix provided by @haileyok in #29634 . Fixes #29634. # How In the case where badge count is 0, use Android built in notification manager to cancel all notifications. # Test Plan - CI should pass - API should behave correctly in our test app # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
douglowder
added a commit
that referenced
this issue
Jun 12, 2024
… 0 (#29657) # Why The `ShortcutBadger` package does not correctly set the badge count on Android if the value to be set is 0. This fixes the issue, using a fix provided by @haileyok in #29634 . Fixes #29634. # How In the case where badge count is 0, use Android built in notification manager to cancel all notifications. # Test Plan - CI should pass - API should behave correctly in our test app # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minimal reproducible example
https://github.com/haileyok/expo-notifications-badge-repro
What platform(s) does this occur on?
Android - Samsung models, have not tested on others yet
Did you reproduce this issue in a development build?
Yes
Summary
On Android - at least on some devices, tested on Samsung - calling
setBadgeCountAsync(0)
does not reset the badge. CallingsetBadgeCountAsync()
and supplying any other positive number updates the badge correctly, but resetting it does not.I tried using both
applyCount
andresetCount
fromShortcutBadger
but neither worked - even though they both returntrue
(or simply does not throw when using theapplyCountOrThrow
that this package currently uses).Screen.Recording.2024-06-10.at.9.49.48.PM.mov
I managed to get this to work with a little patch, although I don't know if it's a viable solution. I'm fine with PRing if it is, though I don't know what other consequences it might come with.
Screen.Recording.2024-06-10.at.9.51.04.PM.mov
Repro Steps
To see the patch working, remove
.disabled
from the patch in./patches
and do the same, except note that after pressing the clear badge button, the badge does in fact reset.Environment
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.5
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.1 - ~/.nvm/versions/node/v18.19.1/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v18.19.1/bin/yarn
npm: 10.4.0 - ~/.nvm/versions/node/v18.19.1/bin/npm
Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /Users/hailey/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode: 15.4/15F31d - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.12 => 51.0.12
expo-router: ~3.5.16 => 3.5.16
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.2 => 0.74.2
react-native-web: ~0.19.10 => 0.19.12
npmGlobalPackages:
eas-cli: 7.5.0
Expo Workflow: bare
Expo Doctor Diagnostics
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for issues with metro config
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check native tooling versions
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK
Didn't find any issues with the project!
The text was updated successfully, but these errors were encountered: