Files
react-native-firebase/packages/messaging
Ely Alvarado bd4dc06a05 fix(messaging): fix remote notification tokens
* Don't abort registerForRemoteNotifications

The native call to `registerForRemoteNotifications` shouldn't be aborted even if `isRegisteredForRemoteNotifications` returns `true`. This is because after successful registration on the first boot, on successive boots the app `isRegisteredForRemoteNotifications` will return true, and then `registerForRemoteNotifications` won't be called again and therefore the APNSToken will never be set (because it is only set on the `didRegisterForRemoteNotificationsWithDeviceToken` swizzled by the `FIRMessagingRemoteNotificationsProxy`)

* Set APNSToken on didRegisterForRemoteNotificationsWithDevicetoken

This is what `FIRMessagingRemoteNotificationsProxy` does, and doing it here seems to avoid the race condition caused by `didRegisterForRemoteNotificationsWithDeviceToken` here being executed first and resolving the promise before the token is set (at least on iOS 12). It doesn't do any damage anyway to do it here first anyway.

Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com>
2020-03-12 14:27:19 +00:00
..
2019-08-02 21:19:15 +01:00
2019-07-15 01:27:40 +01:00
2019-07-12 14:06:43 +01:00
2020-02-17 12:15:19 +00:00


React Native Firebase - Messaging

Coverage NPM downloads NPM version License Maintained with Lerna

Chat on Discord Follow on Twitter Follow on Facebook


React Native Firebase provides native integration of Firebase Cloud Messaging (FCM) for both Android & iOS. FCM is a cost free service, allowing for server-device and device-device communication. The React Native Firebase Messaging module provides a simple JavaScript API to interact with FCM.

> Learn More

Installation

Requires @react-native-firebase/app to be installed.

yarn add @react-native-firebase/messaging

Documentation

License


Built and maintained with 💛 by Invertase.

💼 Hire Us | Sponsor Us | 💻 Work With Us