1

Trying to implement push notification in a react native app using google cloud messaging. The notification works perfectly on android device in a simulator and in production. But for IOS, it works only locally only when its ran in a device. In adhoc or test flight, it does not work. I am using the APN key. Anyone faced the same issue? I can see a lot of posts in stack overflow regarding push notification not working for ios but none of the post were helpful for me. Here's what I have done till now:

  1. Generated an APN Authentication Key in developer.apple.com
  2. Added that key to ios App in firebase.console.google.com
  3. Run the app in a device using xcode - (Push notification works fine everytime.)
  4. Archive the app in xcode and distribute to AdHoc and install the .ipa file in a device. (Push notification does not work)
  5. Distribute to testflight and test the push notification - does not work

Why would it work in debug mode and not in adhoc or testflight. I checked this:https://stackoverflow.com/a/48111671/8729976 . It says there is a single auth token for both production and development environment so I am guessing its definitely not the key. Here are the sample responses:

  1. When the push notification is delivered we get status 200 with this message: projects/myproject-name/messages/1602538922793273
  2. When the push notification is not delivered, we still get status 200 with this message: projects/myproject-name/messages/0:1602541135340865%6b2d5f5c6b2d5f5c

Don't know what the second message means.

diwask
  • 46
  • 2
  • 5
  • I found adding `contentAvailable: true` in the notification payload helped solve this issue for push notifications. It doesn't solve the issue for notifications from the FCM console. To get the console working you may need to fiddle with `react-native-firebase/` package version numbers – Justin.Mathew Nov 30 '20 at 11:46
  • this version combo might help solve your problem: `"@react-native-firebase/analytics": "7.4.1",` `"@react-native-firebase/app": "~8.2.0",` `"@react-native-firebase/messaging": "~7.5.0",` – Justin.Mathew Nov 30 '20 at 11:51

0 Answers0