what is difference between Push notification and cloud message? - push-notification

what is difference between Push notification and cloud message?
is registration id and device id store in third party ?

Push Notification is a notification that appears on a client app, usually like a popup, that is pushed from a server. That's it. Pretty straightforward. You could also check out this searchmobilecomputing link for a good explanation, or even just doing a quick Google search would return you a lot information about Push Notification.
Cloud Message on the other hand is something vague. If you're referring to the Cloud Messaging in Google Cloud Messaging, then I believe you're giving it too much thought. Google Cloud Messaging (now known as Firebase Cloud Messaging) is the name of Google's free push notification service.
For the registration token, I believe Google stores a copy of the tokens on their end, but doesn't keep track of them. It is the developer's responsibility to keep track of the tokens i.e. storing them in a trusted and secure server.

Related

React native app sending push notification while device is offline

I'm about to develop an app similar to a birthday reminder and I plan to use firebase for push notifications but what makes me second question my choice is whether users will be able to receive a birthday notification if they are offline(not connected to internet for the whole birthday day). I know firebase has some offline persistence support but I'm not sure if this includes push notifications support. Are there any options to achieve that with firebase or with any other tool compatible with react native?
If the device is not connected to the internet, it is going to be impossible to deliver messages to it through Firebase Cloud Messaging or other internet protocols.
The common way to deal with such a scenario is to deliver the message to the device when the user does have an internet connection, and then only display it once it's the right time. By sending a data-only message through FCM, your application code controls exactly what happens with the message data.
There are essentially two types of notifications: in app messaging and cloud messaging. Both are offered by Firebase: In App Messaging and FCM (Firebase Cloud Messaging).
The details you've given about your app is a little bit vague but if you're asking for push notifications, then FCM does the job. FCM will send notification when the app is on background or killed (exited out). When you say device is offline I'm assuming you mean when the user isn't using the phone. Yes, the notification will still come.
https://firebase.google.com/docs/cloud-messaging

Flutter push notification using FCM by topic

hello I'm new to flutter and trying to get push notification in flutter , I have successfully subscribed the user to a topic and sent a notification through the firebase console by topic , what I'm trying to do is to have a button for admins in the app and when they post for a particular topic the users with that topic get the notification I have heard about cloud functions but I don't know exactly where to start ! i hope I made my point ! I have seen some videos that talks about type script but is there is any workaround this ?
The Firebase documentation names notifying the user when something interesting happens as an example use-case. From there:
Developers can use Cloud Functions to keep users engaged and up to date with relevant information about an app. Consider, for example, an app that allows users to follow one another's activities in the app. Each time a user adds themselves as a follower of another user, a write occurs in the Realtime Database. Then this write event could trigger a function to create Firebase Cloud Messaging (FCM) notifications to let the appropriate users know that they have gained new followers.
The function triggers on writes to the Realtime Database path where followers are stored.
The function composes a message to send via FCM.
FCM sends the notification message to the user's device.
To review working code, see Send FCM notifications.

Is it possible to send messages through Firebase Cloud Messaging (FCM) to offline users?

I'm working on a Progressive Web App (PWA) and I need to send important reminders through push messages. Users should receive them even if they are offline.
Is it possible to use Firebase Cloud Messaging (FCM) for that (maybe preload the messages or something like that?) or do I need to get a different route for offline?
Adapted after AL's comments below and Frank's comment above
It is possible to send "push messages" via Firebase Cloud Messaging (FCM) to a device that is offline, BUT the user will only see the message when the device is online again. If the device is offline it cannot receive immediately any (push) message from the "external world". If you want to trigger some reminders that are immediately visible for a device which is offline, you will have to do it locally, on the device, and not by relying on a push from the "external world".
So, having said that, if you want to use Firebase Cloud Messaging to send messages, you can do it by using Cloud Functions, i.e. from a "trusted environment". Have a look at this official Firebase Cloud Function sample: https://github.com/firebase/functions-samples/tree/master/fcm-notifications
You could trigger this Cloud Function when e.g. a new item is saved in the database (Real Time Database or Firestore), or an existing one is modified/deleted, or a file is uploaded to Storage, etc.

Is it possible to get push notification stats like count of deliveries and opens when sending messages through Firebase notification API?

We are about to switch to Firebase notifiaction API from Parse.com (that are retiring their service in jan 2017) to send push notification to our android and iOS Apps.
My question now is that I can't see any statistics about counts of successful deliveries and opens in the Firebase Console for a specific message ? The only thing we get when posting to https://fcm.googleapis.com/fcm/send is a message_id
{"message_id":123456789}
But I havn't seen any documentation on a api how to follow up a sent message with this message_id. And the Firebase console has only the these kind of stats for messages created in the Console Gui, not the one create through an api post.
These stats was availible in Parse.com. But it seems as Firebase Cloud Messaging is a bit more low level, and perhaps these stats doesn't come out the box, so they might have to be custom made in a logging app etc by sending back events from the apps when messages as received and opened etc. Or is there a standardized way that I've missed when reading the Firebase Notification api docs ?
When you send notifications from the Firebase Notifications console, you get statistics about how many people received and opened the messages. But there is no API (yet) for Firebase Notifications.
If you're using the Firebase Cloud Messaging API (https://fcm.googleapis.com/fcm/send), the message statistics don't show up in the Firebase Notifications console. You can (as AL. says) get delivery statistics in the Google Play Developer Console in that case.
firebase allows you to view sent/delivered/opened statuses by default from their website
http://console.firebase.google.com
at the notification section
but I am not sure about the parse.com implementations
also if you are a new comer to firebase let it collect user data for about 24 hours after successfully migrating to firebase
I found that in the first day the notifications weren't really reporting immediately
I think you're looking for the FCM Diagnostics and Statistics feature.
However, this is not visible in the Firebase Console, only in your Google Play Developer Console. And the feature only works if your app is at least in Alpha Testing.

Dynamic Push Notifications

I know that Firebase has recently added support for Push Notifications and while this is a great thing, I only seem to be able to send push notifications manually via the Notifications Panel.
What I'd like to do is to send push notifications within a user scope...Let me explain that. Each User in my App has an account and then each user can join a group. Within this group the user can perform tasks and has a list of chores to do. Now when certain tasks are due for example I want to remind the user of doing it with a push notification. For 1-10 I might be able to pull this off manually, but is there a way to dynamically based on the data in the Database send out Push Notifications?
I know that certain Push Notifications can be created using the Analytics tool such as "Hey you have not visited for 3 days, please come back whatever"... but I'd like to register push notifications such as "I just created a task, this task needs to be done within 3 days. Remind me in 3 days if the task is still not done".
Is this possible with Firebase or do I need to have my own server connecting to Firebase and handling those events?
-xCoder
You need to implement FCM in your client and in a server. Let me put this straight:
First, you need that your client, or app, to register into FCM and get a FCM token that will be used to identify that device uniquely.
Then, store that token wherever you like. It can be into firebase database or other server you may like. I recommend you to store it into firebase if you are using it as a database for your users; that's my case.
Also, you need to implement a http or xmpp server in order to send FCM messages to your registered devices containing the data you are interested in. For example, you can implement a Google App Engine endpoint (can be done with Android Studio and Java) that is quite simple or a NodeJS module, depending on your preferred language.
If you are using Firebase as database you can connect from your server with the appropriate SDK and get the FCM tokens you want from your users, and then send the message to those with data. Don't forget to secure your serve.
The way you implement your server algorithm to send FCM messages depends on your app purposes.
Hope it is clear enough for you. Also you can find all the documentation with a short video that explains the general structure here: https://firebase.google.com/docs/cloud-messaging
You can use cloud functions to trigger on any create, update or delete operation in your database and in the trigger event, you can choose to send in FCM push notifications to the devices of your choice.
Here is the documentation regarding the use and structure of a cloud function: https://firebase.google.com/docs/firestore/extend-with-functions
Hope this helps!

Resources