Firebase Cloud Messaging (FCM) is a powerful tool for sending push notifications across platforms, but one often-overlooked feature is the notification badge—a small visual indicator that conveys critical information at a glance. Whether you're developing an iOS app or implementing cross-platform notification systems, understanding how badges work with Firebase can significantly enhance user engagement and app usability.
What Is a Firebase Notification Badge?
A notification badge is typically a red circle with a number displayed on an app icon, indicating unread messages, pending tasks, or alerts. In the context of Firebase, the badge count is sent as part of the notification payload when using FCM. On Apple devices (iOS), this is represented by the badge field in the APNs (Apple Push Notification service) payload. Android does not natively support badge counts in the same way, but many manufacturers and launchers do display them—especially through device-specific implementations like Samsung’s BadgeProvider or via third-party libraries such asShortcutBadger.
Setting Up Badge Counts in Firebase
When crafting your FCM message, you can include the badge field under the apns payload to specify the number. Here's an example structure:

| Field | Type | Description |
|---|---|---|
badge |
integer | The number to display as the badge on the app icon |
apns |
object | Apple-specific notification configuration |
This badge value is not managed automatically by Firebase—you are responsible for calculating the correct count based on your app's logic, such as unread messages or pending actions. FCM simply relays the number to APNs, which renders it on-device.
Best practices for Managing Badge Counts
Mismanagement of badge counts can lead to user frustration. Imagine opening an app to find no new messages—but the badge still shows “3.” To avoid this:
- Sync badge state with actual data: Update the badge number only when new content arrives and decrement or reset it when the user views the relevant section.
- Use silent notifications: Send background updates to adjust the badge count without alerting the user unnecessarily.
- Reset on logout or app uninstall: Clear the badge value to zero when a user logs out or the app is removed.
- Handle foreground states: When the app is open, update the badge count via local logic instead of relying solely on push notifications.
Platform Differences: iOS vs Android
iOS handles badge counts natively through APNs, so once you send the badge field in your FCM payload, the system takes care of display. Android, however, has no unified badge system. Instead, OEMs like Samsung, Huawei, and Xiaomi manage badges through proprietary APIs. For broader compatibility, integrate libraries like ShortcutBadger, which translates FCM payloads into platform-specific badge updates.

Debugging Badge Issues
If your badge count isn't updating, ensure the badge field is included in the apns payload—not the main data payload. Also verify that your app has permission to display badges and that the notification is not being intercepted by a data-only payload that doesn't trigger visual updates. Use Firebase Console or Postman to inspect your payloads and confirm the correct structure.