Capacitor Push Notifications

Hello, today I was reading Push Notifications Capacitor Plugin API | Capacitor Documentation and I was having some problems trying to figure out some steps that were not described :disappointed_relieved:

Happily, I was able to find Push Notifications - Firebase | Capacitor Documentation (I think that this tutorial should be linked somehow in the main docs :sweat_smile:)

After reading it, I doubt whether the official push notifications plugin works only with FCM as a push provider. If that’s the case, does it mean that this plugin is similar to the Capawesome Plugin for Firebase (@capacitor-firebase/messaging) since it uses also FCM as a push provider then we can suppose that are the same plugin but different implementations?

Thanks for any insight, really appreciated :pray:

On Android all plugins use FCM as that’s the official Android way of sending push.

On iOS the official Capacitor push plugin doesn’t use FCM but APNS as it’s the official iOS way of using push notifications.

The tutorial you link explains how to use FCM in your app also on iOS, basically by telling you how to forward the FCM token to javascript instead of the APNS token and some other basic things that still work no matter if you use APNS of FCM, but if you need to subscribe to topics or other advanced FCM features you’ll need to use a different plugin that exposes those native methods to javascript.

1 Like

Thank you so much for the clarification @julio-ionic

On iOS the official Capacitor push plugin doesn’t use FCM but APNS as it’s the official iOS way of using push notifications.

Another doubt that then comes to my mind is, in the case of the official plugin, you will need then a push provider (or your own solution/backend service) to send the notifications by interacting with the APN server directly, is correct to suppose that Firebase is doing that by using the strategy defined in the guide posted before? Same for other third-party solutions such as One Signal, etc.

Thanks again :pray:

The push “provider” for iOS is APNS, you can communicate with it with POST calls from your own server to Apple servers. But yeah, you need some code in your servers to store the APNS tokens and do the POST to Apple server, remove tokens if Apple tells you they no longer exist, etc.

Services like FCM or One Signal abstract that by providing an UI for sending notifications, a common API for both platforms and/or some additional features and they make the POST calls to Apple servers (and One Signal to FMC servers) instead of your server doing it.

I have not used One Signal, but FCM UI is very limited, for more complex things you still have to send a POST from your server to FCM servers (I guess for One Signal it’s the same) and they will then do a POST to APNS, so the only advantage here is that you have a common code for both iOS and Android instead of doing a POST to FCM for android and do a POST to APNS for iOS.

1 Like

Thanks again for your quick response, at least I have now the big picture of the push notifications system and how FCM and APNs work :pray: