Why firebase is needed for android notifications a

2019-07-20 13:32发布

问题:

I'm working on react native push notifications. i'm looking for some answers before i make a purchase to any third party notification provider

  1. Why do third party notifications providers such as OneSignal, Pusher & PubNub are based on Firebase Cloud Messaging?
  2. Can't they send notifications independently without relying on Firebase. why pay more to third party providers when FCM does the work for free?

回答1:

Firebase is a Brand of Services

First, Firebase is a brand that encompasses more than just 1 thing. For example, there is Firebase the realtime database, and there is FCM (Firebase Cloud Messaging) which is the current incarnation of GCM (Google Cloud Messaging) which came from the original product, C2DM (Cloud to Device Messaging).

PubNub and others are push gateway providers

Second, third party realtime messaging services are not push notification services, rather they offer push notification gateways to the push services: APNS for iOS and FCM for Android.

PubNub Realtime Messaging & Mobile Push Notifications

In PubNub's case (my employer), we provide a realtime messaging service (publish, subscribe and much more) and if you provide a valid APNS and/or FCM payload, we will not only deliver that realtime message to active subscribers, we will also send a mobile push notification to the devices that are properly registered for them on that channel you published the message to. This allows the message to be delivered when the app on the device is either not active (background) or not running and therefore, no active connection to PubNub unless it is running in a background service). Now you can have an active connection to PubNub in the background with proper implementation and permissions from the owner of the device (easier on Android than on iOS which also has a review process that rejects apps that don't qualify as valid background service apps).

For Your Consideration

If you did not use a service such as PubNub or one of the other realtime messaging vendors or a push notification specific service like Urban Airship, you would have to implement your own server-based push notification service which is possible but might be more work than you would expect especially if it needs to scale, be secure, robust, etc.

The real question you should ask is do you need realtime messaging in your app or just push notifications and to what level of scalability where it is worth paying a third party for all that goodness.