how can i send notification from flutter-web to flutter-application? - firebase

I had a project from two application(flutter application) and three flutter-web on the same firebase i want to send notification from the web to the application.
i searched alot for this and i cant find any answer or solution for this case.
I had a project from two application(flutter application) and three flutter-web on the same firebase i want to send notification from the web to the application.
i searched alot for this and i cant find any answer or solution for this case.

I hope you understand that we can't give you the finish solution here. I would recommend to you to go trough this docs.
What we can do is to explain it a little bit. For your solution I would recommend to use FCM. And how they work is that:
you use the Firebase SDK to receive a token from the client device.
you store that token on one of the Firebase databases
when sending a push notification to a device you would need to do it from the Firebase Cloud Functions and use that token to send the message to it. When you do that the device from witch the token is will get the message.
It doesn't matter what platform the device is (web, ios or android). All of them can receive Push Messages (in Web most of them but nor 100% all).
From your use case I would not recommend to use topics. You want to send messages from device to device and therefore the tokens are the best solution for it.

Related

Device-to-device messages with FCM and XMPP

I'm setting up a React Native app to, essentially, send messages between devices (it's not a chat app in practice but technically that's what it's doing). I've decided to use Firebase and the RN Firebase library to manage this.
I've finally got my iPhone receiving notifications from the Firebase notification composer. But it's saying I need an XMPP server in order to send messages from devices.
I do see the example in the RN Firebase docs but I'm hoping to do this app severless, just using Firebase for messaging, db, what have you.
I'm going through docs on Firebase (searching their site for XMPP) but it's not quickly clear, so I'm posting here to see if anyone can point me to instructions to quickly set this up in Firebase itself without running my own server (or that someone would know whether it's possible).

Modify push notifications using capacitor plugin

Is it possible to modify incoming push messages using #capacitor/push-notifications? I‘m sending messages using Firebase Cloud Messaging to my Android and iOS apps, which are encrypted by my backend and should be decrypted by the app. To achieve this, I must modify the messages shown in the notification centers after receiving them.
I didn‘t find any documentation on this, so I would appreciate any hint into achieving this. If this is not supported, is there any other solution I could use?
You can send a data notification (which is not automatically displayed by Android) and then use #capacitor/local-notifications to show the modified notification.

Receive Custom FCM In Unity

I integrated Firebase Cloud Messaging with Unity successfully and I can receive usual messages when I send them from Firebase Console, but I need some extra things.
1 - How can I send my notification as a URL? I mean I want that when user touches the notification it opens the URL that I put in the value in FireBase Console.
2 - How I can send and show a picture and a custom icon in the notification?
Unfortunately, I can't find anything on the internet and official documents confused me.
Is there any way to gain these request only with FireBase SDK?
Thank you.
You have to handle all the messages from FCM manually to get all those features you are looking for. I mean you got the general implementation all the stuff, but you need the unique one. All the notification display settings and notification click handlers have to be implemented on the Android native side.
Probably you will find some interesting FCM asset in the Asset Store with nice notifications customization, not sure. But I would recommend you to surf the Asset Store, maybe there will be some useful packages.

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.

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