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:
- Generated an APN Authentication Key in developer.apple.com
- Added that key to ios App in firebase.console.google.com
- Run the app in a device using xcode - (Push notification works fine everytime.)
- Archive the app in xcode and distribute to AdHoc and install the .ipa file in a device. (Push notification does not work)
- 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:
- When the push notification is delivered we get status 200 with this message:
projects/myproject-name/messages/1602538922793273
- 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.