Repository navigation
9.7.0
Added
-
Android:
getDisplayedNotifications()now exposes custom keys fromNotification.extrasas a top-leveldatafield on the result, matching the iOS shape produced byparseDataFromUserInfo:inNotifeeCoreUtil.m. The non-Notifee branch (notifications not created viadisplayNotification()) iteratesextras.keySet()and copies every key not matching a system-prefix denylist (android.,notifee,gcm.,google.,fcm.) or an exact-key denylist (from,collapse_key,message_type,message_id,aps,fcm_options) into adatasub-bundle. Values are coerced toStringviatoString(). Thedatabundle is always present (possibly empty) so JS consumers can accessnotification.data.foowithout null-checkingdataitself.Important platform limitation — read carefully before relying on this for FCM push notifications. When the FCM Android SDK auto-displays a
notification+datapush while the app is in background or killed, customdatafields are routed exclusively to the tap-actionPendingIntentand are never written toNotification.extras. This is FCM's original architectural design (verified againstfirebase-android-sdksource:CommonNotificationBuilder.createContentIntentbuilds the launch Intent withintent.putExtras(params.paramsWithReservedKeysRemoved())but never callsbuilder.addExtras()on the notification itself), not a Notifee or library limitation. The PendingIntent is opaque by Android security design — there is no public API to read its extras without firing it. As a result, this fix cannot make custom FCM data fields appear ingetDisplayedNotifications()for the FCM auto-display path. Firebase issue firebase-android-sdk#2639 (open since 2021, no resolution as of April 2026) tracks Google's awareness of this gap.Scenarios where the fix does surface custom
dataon Android:- Notifications created via
notifee.displayNotification({ data: {...} })— round-trip through the existing Notifee-owned serialization path (this branch was already correct; the fix doesn't change it, but the JSDoc clarification documents the contract) - FCM data-only messages handled in
onMessageReceivedwhere the app callsnotifee.displayNotification()itself with the data payload - Notifications posted by other libraries via
NotificationCompat.Builder.addExtras(bundle)(rare in React Native apps but supported) - Custom
FirebaseMessagingService.handleIntentoverrides that inject extras into the notification before display (the workaround documented in the upstream issue's comments)
Recommended pattern for full control over FCM push notifications on Android: send FCM data-only messages (no
notificationfield server-side), handle them inonMessageReceivedor a headless task, and callnotifee.displayNotification()to render the notification with full control overdata, channel, styling, and tap behavior. This is also Firebase's official recommendation per the 2018 FCM blog post by Jingyu Shi and the current FCM message types documentation.Reserved top-level keys filtered from
data(any value matching these is dropped): prefixesandroid.,google.,gcm.,fcm.(with trailing dot —fcmRegion,googleish, etc. survive),notifee(no trailing dot — the library's reserved namespace,notifeeFoois also filtered), plus exact keysfrom,collapse_key,message_type,message_id,aps,fcm_options. Thefcm_optionsexact-match achieves parity with iOS on the Firebase analytics-label key while preserving realistic custom keys. Cross-platform divergence: bare-fcmkeys other thanfcm_options(e.g.fcmRegion,fcmToken) are preserved on Android but filtered on iOS — rename server-side if you need strict parity. (upstream: invertase/notifee#393) - Notifications created via
-
Tests:
GetDisplayedNotificationsDataTest— 17 Robolectric unit tests covering theshouldIncludeInDatadenylist filter and theextractDataFromExtrasbundle-to-bundle helper, including edge cases for prefix precision (androidify,googleish,fcmlike), non-String value coercion viatoString(), empty-extras stability, and thefcm_optionsexact-match parity.
📦 npm: https://www.npmjs.com/package/react-native-notify-kit/v/9.7.0