Issue
How can i fix this?
Calling setBadgeNumber(1) get error
-My devices worked well with ShortcutBagder
Environment
Application Target Platform:
android 4.4.2
Development Operating System:
Windows 10 Fall Creator
Build Tools version:
25.0.1
React Native version:
"react-native": "0.48.4"
RNFirebase Version:
"react-native-firebase": "^3.1.1"
Firebase Module:
Cloud Messaging
i resolved this by add: to ./app/build.gradle
compile 'me.leolin:ShortcutBadger:1.1.18@aar'
This should be in the docs!!!!
@evanjmg you should submit a PR!
For those who want to use 4.1x firebase and above, the code had change to as below.
firebase.notifications().setBadge(3);
@kkusanagi I use code but it is work in ios not work android.Please help me!
@HueNguyenFramgia about that, I'm sorry, I'm only tried it on Android.
For firebase IOS, please read through here.
https://rnfirebase.io/docs/v5.x.x/notifications/reference/IOSNotification
Seems like android and iOS are separated.
Or use the original feature in react native as shown here
https://facebook.github.io/react-native/docs/pushnotificationios.html
I also try to use the setBadge on Android and it is not showing the badge.
Using the following code:
if (Platform.OS === 'ios') {
ShortcutBadge.setCount(JSON.parse(amount));
}else{
firebase.notifications().setBadge(JSON.parse(amount));
}
It works on iOS, but on Android it doesn't show the badge. Does anybody got this working?
I have the same problem @udarts.
Have you fixed the issue ?
Try it on real mobile phone. Mine won't work on emulator.
Also pls follow the direction setup on
@udarts @JB-CHAUVIN did you get any solution on this
i resolved this by add: to ./app/build.gradle
compile 'me.leolin:ShortcutBadger:1.1.18@aar'
dependencies {
implementation "com.google.firebase:firebase-core:17.0.1"
implementation "com.google.firebase:firebase-messaging:19.0.1"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' <---- add this
}
That library is not maintained and badging on android is basically not supported and thus not a good idea to agree to deliver as a developer. Read up on how it is supported (only some launchers, launcher-specific implementations, specifically not supported in AOSP or on pixels) and best practice on Android is to not do it.
Most helpful comment
For those who want to use 4.1x firebase and above, the code had change to as below.
firebase.notifications().setBadge(3);