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));
}