invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.69k stars 2.21k forks source link

Notifications.setBadge() causes native crash on Android when ShortcutBadger is not installed #1524

Closed paour closed 5 years ago

paour commented 6 years ago

Issue

On Android, when not using the optional ShortcutBadger dependency, the app suffers a native crash when setting a badge (for iOS).

The crash log contains Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lme/leolin/shortcutbadger/ShortcutBadger;, which makes sense.

I would expect an optional dependency to be handled in a safer manner by RNFirebase, testing whether that class is available before trying to use it, and writing a warning to the log rather than crashing…

Another way to handle this would be to implement an IOSNotifications class, similar to AndroidNotifications, to expose iOS-specific features (since explicit badges on Android are not standard, and the OS/launchers handle displaying notification dots on top of app icons that have outstanding notifications).

Environment

  1. Application Target Platform:

Both, but the crash affects only Android.

  1. Development Operating System:

macOS High Sierra

  1. Build Tools:

Not dependant on build tool version.

  1. React Native version:

0.55.4 (not specific to this version)

  1. React Native Firebase Version:

4.3.8

  1. Firebase Module:

Notifications

  1. Are you using typescript?

No

stale[bot] commented 5 years ago

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

mikehardy commented 5 years ago

This is a reasonable point, and if the general stance is that badging isn't great (per discussion here #2076) then I'd expect more people to opt out on Android and decrease their dependency size, but if it's marked optional then you wouldn't necessarily expect to have to platform-check your code while still badging on iOS. If someone posts a PR for this I'd include it in a release for v5 and forward port to v6 etc

stale[bot] commented 5 years ago

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.