Modify push notifications using capacitor plugin - push-notification

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.

Related

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

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.

Send notification when something change in Database

I want to implement logic to my xamarin.Forms application (for android and Ios), which sends notification to user when something new appears in database. For example when other user add an invitation to database, invited user will receive it. Thanks
If you want to send out push notifications, take a look at One Signal. It is free to use and in my experience is also the easiest to set up with Xamarin.Forms. You would need to follow their tutorial on how to get things set up for iOS, Android, and your server side implementations. After that when something in your DB changes just send a push notification from your server.
Here is a link to the Xamarin.Forms setup: One Signal - Xamarin.Forms
You can also use them to notify the users via email, however I have not tried that.
It depends completely on your underlying backend and services (REST? Websockets?, ...) and is to general to answer clearly.
For a good instruction how to use notifications in Xamarin.Android, take a look here:
Local notifications on Android

Firebase Cloud Messages Push Notifications

I have developed a simple android app using Firebase database to store stuff.
Now, I want to set up notifications for each time a button is clicked.
Each time the button is clicked, it will take some info from firebase (text mostly) and will send a notification to anyone who downloaded the app.
I understood that simply creating a notificationManager won't work as needed.
I also heard about Firebase Cloud Messaging but im pretty new to this so I must know what I should start learning to make that work out.
So, if you have any good tutorials or anything helpful, that would be great!
Thanks!
You need to receive for the FCM in android app. Refer this doc. And you need to can use database triggers in firebase cloud functions to send FCM notification, or you need to deploy a cloud http function to do so.

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.

Resources