How to Send and receive Scheduled notifications FCM Flutter [duplicate] - firebase

I have working with FCM console to send push notification and it has an option to schedule the delivery date.
But in the references, this API is not documented as an option. I need to know if its possible to push a notification with predefined delivery date through a POST request.

If you're looking for a public API of FCM for a scheduled push or a payload parameter where you can set the push date, unfortunately, there's nothing like it as of the moment.
You must implement your own App Server and implement the scheduled push yourself (also mentioned it here).

As an alternative to ALs excellent answer: you could:
send a data message with FCM straight away,
in that message include a field with when the message is to be displayed,
them in your application code show the message when it is due.
This has the added advantage that the message can be delivered when the user has a connection, and then displayed when they don't have a network connection.
Of course this only works if you can determine the exact message before it is displayed. If the contents of the message can only be known right before it is displayed, you will need to implement your own mechanism to schedule deliver as AL said in his answer.

Related

How to send a push notification from the Firebase console to a specific GCM/FCM device token ID

In Urban Airship, when I am composing a notification, I can target specific users by searching for a Urban Airship channel_id (device ID):
I sent from Urban Airship the push notification that I am showing above, and I received it successfully. Now I want to do the same thing, send a push notification to a specific device, but now using the Firebase console. The problem is that in Firebase, in the step where I need to specify the target, it only allows me to choose User segment or topic. I was expecting to see a third option: Target specific users (for sending notifications to one or many specific GCM/FCM device token IDs. So my alternative is to add a GCM/FCM device token ID to a topic and then send the push notification to that topic, which is something that I have successfully done before. Nonetheless, that would be a workaround and not the way I would prefer to do this. Is it possible to send push notifications to specific users (by defining the target GCM/FCM device token IDs) from the Firebase console? Thank you.
UPDATE 1: See how the Firebase console (https://console.firebase.google.com/) only shows User segment and Topic as the Target:
First Step:
Second Step:
Third Step:
By design, the notification feature in the console is for sending out broadcast-type events. Sending user-specific alerts would be more of a programmatic operation done through the API.
For sending test messages, there is a console tool for this, explained here.
Note that it is possible to send a notification to one device by subscribing a device to any topic and sending the notification to that topic in the console (keep in mind topics are public and you can't prevent users from signing up to them; fine for testing most likely).
Another alternative is to send a message via HTTP or curl. Perhaps the best resource for this is the quickstart/messaging example.

Does Ionic 2 support private & public Firebase notifications?

I'm thinking to work on firebase notifications in the last few days but I want to some answers for this few questions:
Does Ionic2 support firebase notifications ?
Will notification show in the top of screen when my application closed or it should be work in the background ?
Is firebase notification sent on time or it may take long time ?
If I assumed Ionic 2 can send private notifications (to my device only), so can I send public notification for all application users ?
If the answer of all questions "yes", wish you give me any useful links that may help me (if you have a time)
In addition to Gabriel's answer:
The default behavior for notifications is for it to show on the top part of the screen. I haven't worked on Ionic before, but AFAIK, the behavior should compared to Android.
With that said, you should refer to the Handling Messages part of the FCM docs.
There are factors to consider that may affect the time it takes for the device to receive a message, but as FCM's behavior, it would try it's best to send the message, as soon as feasible (see my answer here).
Gonna itemize this further:
Specific device only - Yup. When sending the message, just specify the registration token(s) that should recieve that message.
All devices - Yup. You could use the Firebase Notifications Console. But if you intend to send the message by using the REST API, you have to make sure that the devices are subscribed accordingly to your custom global topic.
About the device-to-device Gabriel mentioned, I think it should be worded as server to specific device(s).
Yes it does, and it works fine with FCM (Firebase Cloud Messaging, aka GCM - Google Cloud Messaging). It supports subscribing to topics and device-to-device notification via HTTP client. The topics subscriptions and device-to-device both require FCM plugin.
Yes, they'll appear on top of your device screen as any push notification, you'll just need to code how it'll behave after receiving it, like execute something if the notification is tapped, or do something if it's received and the app is already open (foreground), it's all up to you.
It's sent on time, i've never had delay problems, the longer it took to send the notification and i receive in my device was 10 seconds. But as far as i know it "stores" your notification for 24 hours, so if the servers go down or something happen the notification has a life time of 24 hours to be sent.
You can, as said in first answer, subscribe your users to topics. Let's say you want a topic to sent message so all users can receive, you can have an all topic, or have one only for logged users, one only for users who bought products, you can even get all users tokens and send one by one, but it's much better having them subscribe to topics.
Topics notifications can be sent via the Firebase project console. Device-to-device is sent by your app code.
To send device-to-device you'll need a token, it's provided by the FCM plugin (link above) and you'll need to store this token somewhere, like in your user node on Firebase. I usualy use the user device ID provided by the Device plugin to have his token, since the user can have multiple devices and log in all then, this'll prevent token overriding.
I don't know good tutorials about configuring FCM with Firebase, if i find something i'll edit the question and add it for you, but stick to the ionic native link and the FCM plugin github page.
Hope this helps.

How to View Firebase Notification Delivery Reports?

We use Firebase to send push notifications to both Android and iOS devices. We use Http (not XMPP).
How to get delivery reports for push notifications? We want to check if a push is delivered to devices (both Android and iOS).
I cannot see any stats or reports in Firebase console.
Please help.
As seen in the Possible Duplicate Post I linked, there is currently no available reports for FCM, other than what can be seen in the Firebase Console (if you sent the message using the console) and using the Diagnostics/Statistics tool in your Play Dev Console.
There is no API that retrieves these FCM log details as of the moment. However, there's been a recent improvement in the Firebase Notifications console where stats (sent count only for now) for messages sent using the FCM API is included in the Firebase Notification console stats. From my answer in the similar post:
As of August 2018, stats for messages sent using the FCM API are now visible from the console. From the Cloud Messaging section, click on the Reports tab. From there, you will be able to filter by message type (notification, data, and all)
It would seem that the Impressions and Opens are still only available for messages sent using the console. But Sends for sure now counts the messages sent using the FCM API.
Reference: https://firebase.googleblog.com/2018/08/in-app-messaging-crashlytics.html
Our findings: In order to view statistics for Data messages, the data messages will need to include an analytics label. Check to make sure that these are included. It is just a label, https://firebase.google.com/docs/cloud-messaging/understand-delivery#adding-analytics-labels-to-messages so even without the analytics label, the message should still be sent. It just won't be tracked by their reporting. Data messages do not automatically generate a notification though. Different app states and message types will have different message receiving behavior. A data message should be received in onMessage or setBackgroundMessageHandler for JavaScript clients. Try checking these callbacks to see if the message is received there. I'd highly recommend checking out the quickstart, which should be working fine. You can use it as a base to build off or reference to compare with your app to identify potential problem areas. So our understanding is that it needs to be handled properly on the mobile end, https://firebase.google.com/docs/cloud-messaging/js/receive (though this is the javascript client, it will still apply to mobile).
You can rather go to the Google cloud console to check messages sent.
Select period from available options on top right of the page.
https://console.cloud.google.com/apis/dashboard?folder=&organizationId=&project=[project-name]
The delivery report added to the FCM:
Received (available only on Android devices) — The data message or notification message has been received by the app. This data is available when the receiving Android device has FCM SDK 18.0.1 or higher installed.
https://firebase.google.com/docs/cloud-messaging/understand-delivery#message-delivery-reports

FCM Schedule delivery date or time of push notification

I have working with FCM console to send push notification and it has an option to schedule the delivery date.
But in the references, this API is not documented as an option. I need to know if its possible to push a notification with predefined delivery date through a POST request.
If you're looking for a public API of FCM for a scheduled push or a payload parameter where you can set the push date, unfortunately, there's nothing like it as of the moment.
You must implement your own App Server and implement the scheduled push yourself (also mentioned it here).
As an alternative to ALs excellent answer: you could:
send a data message with FCM straight away,
in that message include a field with when the message is to be displayed,
them in your application code show the message when it is due.
This has the added advantage that the message can be delivered when the user has a connection, and then displayed when they don't have a network connection.
Of course this only works if you can determine the exact message before it is displayed. If the contents of the message can only be known right before it is displayed, you will need to implement your own mechanism to schedule deliver as AL said in his answer.

Send Parse Push Notifications with ASP.net

I have developed an android application with the Parse push notification service and I can send notification from the Parse website.
How can I send push notifications through my own website using ASP.net? Is there any way?
I checked the Parse documentation but i get confused, I would really appreciate it if someone would help me.
Thanks
I ran into similar confusion. I wasn't even sure how to properly setup the user so that I could send a push notification directly to them. Then I found the following post:
Channels and Targeted Push Notifications
Note the last item under the Channels heading:
Most apps might find it useful to have a channel for each user so that
they can send messages to a user across all their devices and have
users follow others in the app.
So, now I know that I should subscribe each user to a channel that uniquely identifies the user (e.g., the 'bobsmith#foo.org' channel).
After I have subscribed the user to their channel, I can call Parse's REST API via my ASP.NET application. See Sending Pushes in the Parse REST API Developers Guide.
For an ASP.NET/C# example of how to submit a push notification check out this answer.

Resources