react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Update ShortcutBadger

Open MatthieuPeyrot opened this issue 9 years ago • 18 comments

Hi

I have an issue on my samsung galaxy S6 , it crash when i try to update the badgeNumber. I thing it because you are not using the last version of ShortcutBadger

you are using : compile 'me.leolin:ShortcutBadger:1.1.10@aar' now it's : compile 'me.leolin:ShortcutBadger:1.1.18@aar'

that's the crash :

0 | io.invertase.firebase.messaging.BadgeHelper.setBadgeCount | BadgeHelper.java:33 1 | io.invertase.firebase.messaging.MessagingService.handleBadge | MessagingService.java:41 2 | io.invertase.firebase.messaging.MessagingService.onMessageReceived | MessagingService.java:23 3 | com.google.firebase.messaging.FirebaseMessagingService.handleIntent | Unknown Source 4 | com.google.firebase.iid.zzc.run | Unknown Source 5 | java.util.concurrent.ThreadPoolExecutor.runWorker | ThreadPoolExecutor.java:1133 6 | java.util.concurrent.ThreadPoolExecutor$Worker.run | ThreadPoolExecutor.java:607 7 | java.lang.Thread.run | Thread.java:762

  1. Target Platform (Android):
  2. Development Operating System (macOS Sierra):
  3. React Native version (0.47.2):
  4. RNFirebase Version (2.1.3):

MatthieuPeyrot avatar Aug 24 '17 09:08 MatthieuPeyrot

screenshot_20170824-125516

MatthieuPeyrot avatar Aug 24 '17 10:08 MatthieuPeyrot

Have the same issue but using the last version of me.leolin:ShortcutBadger:1.1.18@aar doesn't fix it.

gusgard avatar Aug 25 '17 10:08 gusgard

Me neither

MatthieuPeyrot avatar Aug 25 '17 14:08 MatthieuPeyrot

@MatthieuPeyrot I'm unable to reproduce this. Can you send the contents of your app/build.gradle?

chrisbianca avatar Aug 29 '17 16:08 chrisbianca

hi i maybe find a solution i don't have the red screen by adding this in the build.gradle

repositories { mavenCentral() }

but the notif badge don't change on my samsung device.

MatthieuPeyrot avatar Aug 30 '17 07:08 MatthieuPeyrot

The ShortcutBadger lib has an app to test if it works on your phone: https://play.google.com/store/apps/details?id=me.leolin.isbadgeworking

I got the link from their repo: https://github.com/leolin310148/ShortcutBadger

We tried it on several phones and only one of them actually showed the badge

erezrokah avatar Aug 30 '17 08:08 erezrokah

it work on the samsung galaxy s5 (android 6 )but not on the s6 edge (android 7 ) But i have to add compile 'me.leolin:ShortcutBadger:1.1.18@aar' and repositories { mavenCentral() } on my build.gradle not on react native firebase that's weird

MatthieuPeyrot avatar Aug 30 '17 15:08 MatthieuPeyrot

I've updated the dependency to the latest version of Shortcut Badger for the upcoming v3 release

chrisbianca avatar Aug 31 '17 08:08 chrisbianca

Still happen this problem with the last version. I don't know why because i can see ShortcutBadger exported like a Library in the react-native-firebase project. But it works like @MatthieuPeyrot said. Could be my version of gradle (2.3.3)? is necessary to have 3.0> ?

cluny85 avatar Oct 16 '17 15:10 cluny85

This still happens with latest build.

hegelstad avatar Feb 04 '18 21:02 hegelstad

There is no documentation after v3.3.x. I think they had remove it.

kkusanagi avatar May 28 '18 14:05 kkusanagi

Still happening with 4.2.0

haseebnaseem avatar Jun 13 '18 12:06 haseebnaseem

implementation "com.google.firebase:firebase-messaging:17.1.0" implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

I've downloaded the 'isBadgeWorking?' in a Samsung and it's working. But it does not work when my app receives a message and shows the notification.

turboc avatar Aug 21 '18 15:08 turboc

About this, it got a simple method. Follow the step below. react-native-push-notifications-with-firebase-cloud-functions

Use below payload while sending notification.

let payload = {
      notification: {
      title: 
      body:
      sound:
      badge:
     }
    }

Or,

Use firebase console to send a notification to your mobile phone by token. Of course, you can also send a notification to all mobile that use the app.

if your phone receive notification, mean it works. if not, there is something wrong with your setting.

Finally as for this thread issue, you need to use

firebase.notifications().setBadge(10). //to set badge number

firebase.notifications().getBadge() // to get badge number

Firebase Notification Library

kkusanagi avatar Aug 22 '18 05:08 kkusanagi

implementation "com.google.firebase:firebase-messaging:17.1.0" implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

I've downloaded the 'isBadgeWorking?' in a Samsung and it's working. But it does not work when my app receives a message and shows the notification.

thanku so much @turboc . u saved my day.

Biplovkumar avatar Oct 14 '20 19:10 Biplovkumar

Careful - ShortcutBadger hasn't really been updated in 2 years https://github.com/leolin310148/ShortcutBadger - it doesn't work on all vendors and Google specifically will not support badging. Attempting to do badging on Android is fighting the platform - something that always results in resources spent for little gain

mikehardy avatar Oct 14 '20 19:10 mikehardy

Hi, I have a issue: setBadge(0) in android not working , getBadge() in android is 0 but in icon app show number >0.

    const currentNumber = await firebase.notifications().getBadge()
    console.log('currentNumber ', currentNumber) // in here currentNumber = 0
    if (number <= 0) {
      await firebase.notifications().setBadge(0)
      // go to here but in icon app, badge >0
    } else {
      await firebase.notifications().setBadge(number)
    }

Please help me. "react-native-firebase": "5.5.6" "react-native": "0.63.3"

huent-1493 avatar Dec 16 '20 09:12 huent-1493

No help whatsoever is offered for react-native-firebase v5 And specifically, badging in general is an anti-pattern on Android because it is not part of the platform and specifically not a desired feature in AOSP. It was removed on purpose

mikehardy avatar Dec 16 '20 14:12 mikehardy