Migrating from Socket.io to Firebase Cloud Messaging - firebase

We currently have a hodgepodge of messaging systems. For mobile we were using Ionic Push cloud service, and for desktop we are using socket.io+desktop notifications. We recently moved our mobile push notifications to Firebase cloud messaging. We want to move our desktop notifications as well. From the docs, it seems like FCM works with recent versions of Chrome and Firefox. Safari supposedly supports push via APNs.
Is it possible for FCM to use the existing desktop notifications for push?
Or maybe I can use FCM just to retrieve push notifications across all browser and then use the desktop notifications libraries myself to display the message. I'm just a little confused by the landscape of types of pushes to browsers and desktops.

Related

How to implement push notifications using FCM for amazon kindle FireOS

I have used FCM to implement Push notifications in react-native application for IOS and Android but could not get push notifications in Amazon kindle FireOS Tablets . how can I solve this issue.
FireOS is a fork of Android. For Android, Firebase Push Notifications requires Google Play Services (https://firebase.google.com/docs/cloud-messaging/android/client) which doesn't come on FireOS Tablets, but you can install it. To do so requires 4 apks - Google Account Manager, Google Services Framework, Google Play Services, and Google Play Store, as described in this article (https://www.androidpolice.com/2020/07/11/install-play-store-amazon-fire-tablet/). Before I did this, debug from my app on a Fire tablet showed a Firebase error. After adding Google Play, Firebase now initializes with no errors, "FirebaseApp initialization successful", but it still doesn't actually receive the push notifications. So I'm assuming there is something required deeper in the OS stripped in the FireOS fork of Android.

Push notifications in Apple Safari with FCM

We implemented push notifications using FCM in chrome and firefox and it worked fine, but Safari doesn't support Service Workers which is mandatory for FCM.
Did anyone deal with this kind of issues? any suggestions?
While Service Workers now work on Safari, they are not enough.
The documentation says:
The FCM JavaScript API lets you receive notification messages in web apps running in browsers that support the Push API. This includes the browser versions listed in this support matrix.
So the ability to receive messages through FCM depends on the browser implementing the Web Push API, which Web Kit does not.
Safari is built on Web Kit, so doesn't support web push, so that means that Safari can't receive FCM notifications. All browsers on iOS devices are also built on Web Kit (as that is a requirement from Apple), so FCM won't be able to receive messages in any of them either
If you want to test whether the environment your code runs on can receive messages from FCM, you can use this snippet of code:
if (firebase.messaging.isSupported())
...
}
Update (2023-02-16): WebKit.org just announced support for Web Push in iOS/iPadOS 16.4 beta 1. We're investigating whether this also impacts Firebase Cloud Messaging's ability to deliver to devices with this version.
Safari still does not support Web Push API, thus Firebase Cloud Messaging service.
Here is supported browsers in Firebase:
https://firebase.google.com/support/guides/environments_js-sdk#browsers
I'd suggest using .isSupported() instead of other solutions.
if (firebase.messaging.isSupported())
const messaging = firebase.messaging();
}
See the documentation for details on .isSupported().
I'm not sure about this new Safari and Service Workers situation, but I tried to implement FCM push-notifications in my iOS app and had to experience that you need an APN (Apple-Push-Notification) certificate first. I'm not sure if this is needed if you're working with Safari, but I could imagine that Apple also wants it's push notifications first to be redirected to the APN servers.
Apple says that Safari 16 (macos) should now support Push API but I didn't manage to make push API notifications work correctly. I tried firebase messaging web v9 (which should be a wrapper over Push API from what I understand) and it seems to work in background (when delivered by the service worker) but in foreground only receives notifications 3 times, then it stops working.
FCM doesn't support Safari browser.
If you want to integrate PUSH notification for Safari browser, follow this link. Safari has its own mechanism for it.
https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW1

Local notifications with Unity (Firebase?)

Is there an easy way to implement local notifications from the Unity client?
I'm using Firebase for handling our push notifications (which are sent from our server), but I was wondering if there is an easy way to support local notifications?
I found this question: Firebase local notifications
But it is specifically to iOS.
I was wondering if there is a solution for Unity (without the need to write some iOS and Android plugins) where I can schedule local notifications from the client side.
It seems that for iOS you can do it directly from Unity, without iOS native code (like presented here).
For Android, you can use an existing plugin, like this, or this

Phonegap notification options that work for both for iOS and Android

I am building mobile apps for iOS and Android using PhoneGap Build. I would like to send push notifications to both types of device using the same server-side process. Is this possible?
Apple's certification process to enable push notifications is painful, much more so than anything available for Android. Do I have to use it?
GCM (Google Cloud Messaging) says it supports both operating systems, but the more I read about it - with respect to Phonegap - the less I see iOS mentioned! And sadly the GCM/Phonegap plugin doesn't support subscribing to a topic, which is a way of sending one message out to all devices in one go via a 'global' topic.
UrbanAirship and PushWhoosh seem to integrate with Phonegap, but I am forced to use their website to create my messages. GCM looks more attractive in this respect, because I can get our own ASP.NET server to talk to GCM via HTTP and thus control messages from our databases.
Main question: Are there any options for a single server-side option which can send push notifications to both iOS and Android via a single Phonegap plugin? (Ideally I would control messages from my own server, where one message can go to all Android/iOS devices in one go, and avoid as many Apple certificates as possible.~)

Can use Google's Cloud Messaging for iOS in a hybrid app?

I am planning to build a "hybrid app" using PhoneGap which needs to have a iOS push notification engine.
And I want to use Google Cloud Messaging for sending push notifications to the iOS (I have used this for sending notifications to Android).
My questions here are:
Can I use Google Cloud Messaging for iOS in an hybrid app (using PhoneGap's https://github.com/phonegap-build/PushPlugin)?
Are there any changes that I may have to do while using the above plugin?
I have used the above PhoneGap plugin to receive notifications from GCM and APNS separately but this time I want to use the GCM for both iOS and Android.
Any help will be appreciated.
I also have used GCM and APNS separately for send push notifications to Android and iOs devices independently.
For all the documentation I've read, GCM for iOs devices is an approach of the APNS service but using the same structure that GCM is using for Android devices. I think that if you have used the APNService, you have found all the hard steps (certificates, using strictly a Mac for some things, ...) so, answering to your questions:
Yes, you can use the GCM for iOs with Phonegap plugin because GCM Server sends the data that PhoneGap's plugin is ready to receive (as you can see in the GCM Server Reference there are some data specific for APNS (nothing that you don't know if you have worked with APNS)).
If you are preparing a native app for iOs, you should see the GCM iOs Client documentation because you will have to use the iOs API but it's not your problem.
I don't expect that you have to do changes while using PhoneGap's plugin. You will only have to use PhoneGap's implementation for iOs devices and get ready to receive push notifications (but if you have some troubles, please, I will be pleased to know them).
Good luck!

Resources