0

I want to show the badge count of the push notifications when the app is in background.

I've tried by setting the badge count inside the oncreate() method of the class which is extending FirebaseMessagingService and the badge count is working. But this oncreate() method is getting called each time when new firebase token is generated so badge count goes wrong.

public void onCreate() {
    super.onCreate();  
    String badgeCount = sharedPreferencesObj.getString(key, "");
            ShortcutBadger.applyCount(MyDocPatientFbmService.this, String.valueOf(badgeCount));
   }
Manu Ram V
  • 369
  • 1
  • 3
  • 23

1 Answers1

0

Approach might be different for different phone Launchers apps and manufacturers. New android API lets you have new kind of "badge" please read this

Antonis Radz
  • 3,036
  • 1
  • 16
  • 34