I am facing a problem with receiving push notifications on iOS using Capacitor and Firebase Cloud Messaging. Here are the details:
PushNotifications.register() runs successfully and the FCM token is obtained from iOS device."@capacitor/core": "^5.0.0", "@capacitor/push-notifications": "^5.0.4" and "@capacitor/ios": "^5.0.5".Despite these steps, notifications are not received on iOS devices/emulators. I would appreciate any guidance. Thank you in advance.
I used @capacitor-firebase/messaging plugin instead of @capacitor/push-notifications and that worked for me.
( This guide helped me ,Thanks to RGe )
I encountered the same issue. I simply followed this guide: https://capacitorjs.com/docs/apis/push-notifications. However, the problem is that many steps are missing from this guide. You don't need to replace the npm package @capacitor/push-notifications as suggested in the accepted answer.
In addition, follow this guide and the problem will be resolved: https://capacitorjs.com/docs/guides/push-notifications-firebase#prerequisites
Background: Without the Firebase initialization code mentioned in the prerequisites, the push token has an incorrect format.
Without the prerequisites, the push token you receive from the looks like this: 3B7CA1BCAE6B0C972CCE9D9D10B98E88160185A8D65C08294F4EFBA509D5E539
After completing all the steps successfully, the token has a different format with colons and dashes, and it becomes significantly longer. I hope this helps!
Token format after including the prerequisites:
fAs7FPRhTGqH9gXMYX3vHy:APA81bF9gCc99u-Q2IuylC9Nctn1nAmlVgCu3U8dCvSHvWIX3MHFG1t5BoXFS6CCkSETiB9iqxz-CgyNtfn2DJYFF3vod_puQOW2xsh-a_I7XfURFAJqSmrQDBo9RCc55XX-3N47Bq54
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With