Open gabeDevlift opened 3 years ago
@gabeDevlift have you managed to fix the issue?
I have the same problem. It looks like the repository is abandoned :(
@osvald0, I've managed to handle the issue by switching to https://github.com/zo0r/react-native-push-notification
And using:
import RNPushNotification from 'react-native-push-notification';
RNPushNotification.setApplicationIconBadgeNumber(unreadNotificationCount);
It worked fine for both Android and iOS.
@osvald0, actually, that might not be the full solution. In android, the notifications stay in a tray and that was the actual reason for getting the badge number reverted. To get rid of the notifications you need to cancel them:
RNPushNotification.cancelAllLocalNotifications();
Yes, cancelAllLocalNotifications
works fine.
Thanks @Froncz !
@osvald0 @Froncz Did you try this on an emulator or a physical Android device? Can you share on which model or specifications you managed to display the notifications badge?
@andresliu-mks physical device, Samsung A30 and Samsung A52.
@andresliu-mks physical device, Samsung A30 and Samsung A52.
Thank you. Did you just follow the setup and usage instructions and it worked? I can't seem to get this library working on any device @osvald0
Okay, so I found out that the badge would appear with the number you set only after receiving a push notification (I only tested this with remote, not local ones)
@Froncz thanks for sharing, but it seems like it's not functional on android emulator? or is there anyone have any idea to deal with this problem? @andresliu-mks
I originally had a badge number of 2. I used
BadgeAndroid.setBadge(15);
in my code, and it worked. However, when I triedBadgeAndroid.setBadge(0);
, the badge number reverted to 2.Does anyone know why this might be? Is there any other info I can provide?