Push notifications through cloud messaging - firebase

How can I perform a cloud function that is responsible for sending push notifications to mobile devices (Android or ios) previously registered from an app and that previously saved the messaging key on the server? The idea is that when there is modification of a child in the realtime a push notification is sent to the user. Thank you

Related

Firebase Cloud Messaging notification permission?

I have a web application and I want to send notification via fcm. But not with this browser push notifications. I will list it in the app. How can I do this without having to allow notifications in the user's browser?

Is it possible to implement notification grouping/bundling using FCM in ionic?

I'm sending notifications to users with FCM (firebase cloud messaging) using firebase functions.
If a notificatoin sent while there is already old notification in the device I want to group those notifications like SetGroup does.
Is it possible?

When to use iOS device token when sending push notifications through FCM?

I'm confused about the implementation of cloud messaging through FCM. To send an iOS device a remote (push) notification, an iOS device token is needed for APNs. However, a Firebase app doesn't interface with APNs, it interfaces with FCM, which interfaces with APNs. But to send a push notification (or message) to any client through FCM requires an FCM token. Does this mean that the iOS device token is not needed for a Firebase app to send push notifications to iOS devices?
Only an FCM token is required to send a message to a device. There is no Apple-specific data required. Firebase handles the details of each underlying push notification system.
Firebase uses method swizzling to automatically map your FCM token to your APNs token, as explained in the Firebase Docs here (or see images below).

How Firebase push notification work on IOS?

I want to create my own push notification mechanism for my own iOS applications.
I compared some services like pushy.me or Google Firebase. I think Pushy is the only service that can push notifications independent from Apple APNs, but it uses simple HTTP long-poll requests to receive notifications (in the iOS SDK).
But how does Firebase work? Does it still depend on Apple's APNs? How will it affect my battery life?
Firebase Cloud Messaging (FCM) delivers push notification to iOS devices via Apple's Push Notifications service. Also FCM extends functionality of push notifications.
How FCM extends?
FCM works with iOS and Android. Cool feature if you have the app for both platforms;
Don't need to develop backend for sending notifications, storing pn tokens etc. Just register your app in the Google Developer Console and follow User Guides. For sending a push just execute request to https://fcm.googleapis.com/fcm/send with params;
Broadcast notifications. The app subscribes to a topic and then you can send a notification to all topic subscribers. Very cool;
Upstream messages (send data to the server)
Also Google has others services you can extend FCM with. For example Cloud Functions.
I didn't find that FCM integration take big affect to battery life in my apps.
UPDATE:
FCM framework sends push notification token (and other info) to Google services. Also as I mentioned above you can subscribe app for a specific topic. Than Google knows which device needs to send a push to.
There is a possibility to setup FCM in iOS automatically(with using method swizzling). FCM exchange AppDelegate methods and knows your's device pn token.
Firebase Cloud Messaging (FCM) utilizes APNs (Apple push notifications services) for delivering the messages to iOS devices.
So basically, FCM wraps iOS methods like registerForRemoteNotifications or didReceiveRemoteNotification using method swizzling (BTW, you can disable this if you wish, although I can't see any reason...).
On the technical side - the phone is keeping an open connection with APNs and this tunnel is used for sending the messages themselves.

Unsubscribe Firebase Push Notifications from unknown devices

I have implemented the Firebase push notifications in my web application.
I then subscribed from multiple unknown/random devices to receive these push notifications.
How do I unsubscribe unknown devices for my push notifications?
The ability to unsubscribe the user from firebase is still missing.
Refer this firebase document for more details
To do this you will need to call unsubscribe() on a PushSubscription (from the subscribed client)
I am assuming that is not possible in your case. Thus, I would advise you to
change your Web Push certificates from the firebase console.

Resources