Is possible to sending push notification to the existing GCM user from FCM? - firebase

I have the existing app that using GCM and have some issue with GCM reliability. I interested using FCM to replace the GCM, but I doubt about compatibility. I've some google search but still couldn't find a satisfactory answer, here some link:
Migrating from gcm to fcm on android
If FCM inherits from GCM, does FCM also support GCM token? Or we need to some config in the server (using gcm-http.googleapis.com/gcm/ vs. fcm.googleapis.com/fcm/request in one server?)
I still doubt to migrating GCM to FCM, so I need some ideas from you all guys and I think send a notification from FCM console is not scalable for me because of too many notifications that triggered by user activities. Thanks

As much as I have understood from reading various documents and watching youtube recordings of 2016 I/O, FCM appears to be rebranded GCM. Server side integration will stay the same with option to switch endpoint domain name. When look a little closer you see that both domain names are referring to same IP address.
From client side integration much more has changes. FCM has a new SDK which makes certain things little easier to manage. Not sure if there are any improvements in terms of keeping app connected to the backend, listening incoming messages.

Related

Firebase Cloud Messaging (FCM) - HTTP V1 API or Legacy HTTP API?

Our goal is sending notifications to groups of devices from our backend, and only from server side is possible to know which device should receive the notification.
We've done some attempts with AppCenter because we mostly work with Xamarin iOS/Android/Forms, but now we have the doubt that it's probably better to use directly Firebase API because wider and more powerful.
I see that with new version of API (HTTP V1) is not possible to send a notification to a list of tokens, feature that was available in legacy API using registration_ids parameter (https://firebase.google.com/docs/cloud-messaging/send-message).
Device group name (legacy protocols only)
I cannot use topics because when it's time to send the communication is a server's responsibility to prepare the "mailing list" for notifications.
I was thinking to use device group messaging (https://firebase.google.com/docs/cloud-messaging/android/device-group) but these are part of the legacy api, and I'm not sure if it makes sense/it's possible to use them with new version of API.
Is an option to send a batch of 100-200-500 push notifications each one to only one token? In theory there isn't a limit to notifications which is possible to send, but I'm worried that sending too many of them I could risk to be banned.
Is it better to use legacy API? Also AppCenter (Microsoft) uses legacy API, it's evident because of how the setup works and because from AppCenter's console it's possible to send notifications to a list of tokens, feature unavailable on Firebase's console.
Another person just asked something similar but the answer was to use topics (How to send firebase notification for all user at a time?).
Got here from the link in your comment in my answer here. And just to reiterate my response there, when sending messages to multiple tokens with v1, the suggested approach now is to use Topics Messaging, since registration_ids is not supported.
Is it better to use legacy API?
v1 was described as the more secure, cross platform, future proof way of sending messages to FCM clients. More secure since it uses OAuth2 security model.
However, if your use-case is better with using the legacy API, then I suggest you go ahead with using it.
This page suggests that you should stay with the legacy API if you want to continue to use the multicast feature: https://firebase.google.com/docs/cloud-messaging/migrate-v1
Any apps that use device group messaging or multicast messaging, however, may prefer to wait for future versions of the API. HTTP v1 does not support these features of the legacy API.

Web push notifications

I am making a website and one of the features is that whenever a contract is nearing its end, the user should be notified about it. So I was looking for a way to notify users and I found out about push notifications.
Now, there are lots of things written about it. I heard a lot about Google Cloud Messaging, Firebase Cloud Messaging and Service Workers.
Now the thing is that my website will probably be on an Intranet. So maybe I won't be able to use GCM/FCM.
But I have a few questions regarding GCM, FCM and Service-Workers:
Why do I need FCM/GCM?
What is the difference between FCM and Service Workers?
Is there a way to push notifications even if the browser is closed?
Because my website is on an Intranet, is there another way to push notifications to the users?
1. Why do I need FCM/GCM?
You may check here the features of FCM.
Notification payload: 4KB, Message payload: 2KB. Note that the notification includes device and app information too.
Stores 100 notification/messages per device if the device is offline.
Stores notification/messages for 30 days if the device is offline, and deleted them all one this period is over and the device is still offline.
FCM supports Android and iOS devices, and even chrome web apps. The notifications are sent to iOS devices in this way: App Server -> FCM -> Apple Push Notification Server (APNs) -> iOS device -> App.
GCM supports 1 million subscribers while FCM do not have this limitation.
Supports programming in C++.
Less requirements for coding.
2. What is the difference between FCM and Service Workers?
Service Worker is a background service that handles network requests. Ideal for dealing with offline situations and background syncs or push notifications. Cannot directly interact with the DOM. Communication must go through the Service Worker’s postMessage method. Service Workers are pretty perfect for creating offline-first web apps. They let you interact with the server when you can (to fetch new data from the server, or push updated info back to the server), so your app can work regardless of your user’s connectivity.
While using FCM, you can notify a client app that new email or other data is available to sync. You can send notification messages to drive user reengagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.
3. Is there a way to push notifications even if the browser is closed?
Check this thread: Notifications while browser is closed
4. Because my website is on an Intranet, is there another way to push notifications to the users?
Unfortunately, I don't see any documentation regarding this.
Hope my answers help you.

Push notifications: Why use Amazon SNS over Google's GCM/FCM?

I have created a mobile app for Android and iOS using Phonegap Build. Last year I had nearly finished writing code to use GCM (Google Cloud Messaging) for remote push notifications - which can go out via Apple's APNS too - but the project was shelved.
This year the project is resurrected and I find Google has changed everything to Firebase (FCM). I then read some enticing things about Amazon SNS handling notifications. Just when I started to think SNS might be a better option, I noticed you still have to set up GCM/FCM anyway, and pass all those details to SNS.
So is there any benefit to using SNS when I've got to do the full FCM setup as well?! Both services seem to offer the same features: interact with APNS if required, subscribe to topics, provide you with a nice API/SDK, etc. The app code, and the server-side code would be no simpler, as far as I can see. Why add another layer (SNS) on top of FCM?
(I'm trying not to let this be an opinion-based question: I want to know whether SNS is saving me any effort, giving me any advantage, or adding any features that FCM does not have.)
Just some thoughts.
If you are already using some mobile AWS SDK, then it's more convenient to use it for SNS too.
That also helps keep your app smaller.
And you're happier as a developer since API calls are somewhat unified.
If your backend is hosted on AWS infrastructure you can use IAM roles for EC2 instances (also Lambdas etc.) to make those call without access key/secret key.
You get metrics in your CloudWatch.
But Firebase Cloud Messaging is free :)
Let's answer a few questions first.
1.Do you want to develop, maintain and run the code to talk to GCM?
2.Do you wish to do the same for another platform (iOS, Kindle Fire), if you choose to develop your app for other mobile platforms.
3.Do you want to manage change of registration_id's by yourself?
4.Do you care if a notification is delivered to your users a few milliseconds later?
If you answered NO to any of the questions above, I recommend using SNS to deliver push notifications to iOS, Android and Kindle Fire devices.
SNS talks to GCM to deliver notifications to android devices. Here is what SNS can offer you.
Simple API to send notification to heterogeneous platforms.
Manages application registration_ids. As a developer you don't have to worry about change of registration_ids.
Scales really well. You don't have to worry about managing infrastructure if your app becomes super popular.
Can tolerate GCM downtime & throttling.

Should I deploy Firebase Cloud Messaging server myself?

I've read the document about FCM, but I wonder if I should deploy a FCM server myself. Does the google cloud platform not provide FCM server? Or do I must implemented my own FCM server refering to the official reference implementation, gcm-playgroud?
It depends. (How's that for an answer?)
By "server", I'm assuming you mean, "Code I will be running on the server level to communicate with the FCM service". And honestly, the answer depends on whether or not you need extra functionality that's not supplied by the Firebase Notifications panel.
You can do a lot with Firebase Notifications, including sending scheduled messages, or sending messages to individual users, topics, or Audiences. But that is work that is done manually. If you just want to send the occasional promotional message to your users, you shouldn't need a server.
On the other hand, maybe you've got a messaging app and you want to send a notification to your user anytime they receive a new message. Well, that's clearly something that needs to be automated, and that requires some server-side code. So for that, you will need to set up your own server that communicates with FCM.

Is it a good idea to use push notifications for mobile chat applications? (Android, iOS)

The idea of using the push notifications is only to have a notification mechanism that will send a notification when there is a new message waiting to download from the backend service: all the notifications are of the same type e.g. "refresh messages from the server" (the same for Android and iOS).
Are there any limits for the Apple/Google push notifications services?
Assuming that my application will handle more that 100k active users (or even 1M or more users) - would there be any problem with the Apple Push Notifications or GCM services?
If using the push notifications for such a service is not a good idea then what is other solution that could be used for mobile chat applications?
Don't forget that on iOS user may forbid sending notifications, so your app won't receive any even in foreground. Thus, you need to implement your own push mechanism.
Need for push notifications
Especially on iOS you don't have a choice but to use their push notifications service APNS. There is no other way to receive notifications immediately because iOS may kill or neglect the TCP connections of your background app.
On Android it seems possible to use your own background TCP connection to avoid having to use push notifications. But you may still consider the use of the push notifications through GCM for the sake of improved battery usage.
Pricing
Neither APNS (iOS) nor GCM (Android) charge you for the service and you are allowed to send an unlimited number of messages.
Limitations and Requirements
Both services will delete message, when there are too many messages accumulated in the queue for an offline device - which makes sense because there is no point in delivering those messages hours later. You have to take that in to account, when writing your app (just do a poll when going back online).
Depending on the app you are writing, there may also be privacy concerns. Even if you encrypt the message itself, at least Apple/Google know when a notification is sent to a certain device, which may be a deal-breaker for certain high-security applications.
You will also need a server that is able to communicate to both APNS and GCM. There are open source solutions for that (e.g. easyApns for iOS and python-gcm for Android), but how easy their integration is depends on your server and the language it is written in.

Resources