GCM: Message sent on a topic does not reach the browser - push-notification

My setup include a webapp, a backend server and an android app.
I want to be able to chat between my android app and webapp.
Init:
Android app has subscribed to the topic /topics/chatGroupName
Similarly on browser, I get the registrationToken and send it to my server where I use code similar in https://github.com/ToothlessGear/node-gcm/pull/211/files (addToTopicNoRetry) to subscribe the browser to the topic: /topics/chatGroupName
When I send a message from the web, I use my backend server to send a GCM message on a topic like /topics/chatGroupName and the android app receives this message.
But when I send GCM message from Android app on this topic /topics/chatGroupName, I dont get any notification on the browser app.
Even my https://iid.googleapis.com/iid/info/REGISTRATION_TOKEN?details=true shows that this registration token has already subscribed to /topics/chatGroupName

Firebase has now released javascript library that supports FCM push notifications with support for topics.
Ref: https://firebase.google.com/docs/cloud-messaging/js/client

Related

Issue with Firebase Cloud Messaging

Hello stack overflow community, I'm using the cross- platform FCM (Firebase Cloud Messaging) to send push notifications from my server developed with spring-boot java to my application developed with android studio java. I have an issue which is sometimes I send the push notification from the server and everything is fine (the response i get indicates that the push notification has been sent) but I don't receive it on my mobile app.
I should resend it many times to receive the last notification I sent. And sometimes I must wait almost 15 minutes to receive one notification. I want to know if the problem is with my code or in the server of firebase.

React native how to send fcm token to backend and get the notification from backend using onesignal

so im confused regarding onesignal and pushnotification ,,so im tried sending message using onesignal but it doest require any device token mean the fcm token so how does i add fcmtoken to onesignal coz to backend im sending only fcm token (i.e device token) so based on that app should receive the notification but its not working that way can any help me how does one signal works because it simply sending notification from the website but how can i add the thing to backend..if possible send me some youtube or blog where i can go though it

How to Test FCM Data Push Notifications Delivery?

I have an Azure Web Service which is using an Azure Notification Hub to push data notifications using FCM via Firebase to a Xamarin Android App. Initially the app is getting a token which is posted to the web service. The web service then sends it with the data to the notification hub which is sending it to Firebase. The response back from the hub is indicating a successful transfer it seems from the notification properties and the ReqID property. But the notification is not reaching the app. Is there a way to see individual notifications' status on the Firebase site? Currently I don't see anything under the "Cloud" report for Data.
[
Thanks for asking question! One of the notification failure point could be when sending it from FCM to user device. To confirm this, you may try getting a delivery receipt from FCM.
You may refer to this article Receive delivery receipts. It says for Android and Chrome client apps, you can get delivery receipts which can be sent from FCM to your app server. To enable this feature, the message your app server sends to FCM must include the field delivery_receipt_requested. When this field is set to true, FCM sends a delivery receipt when a device confirms that it received a particular message. Also check for firewall on the user's network.

Firebase Cloud Messaging returns 200 OK for token that has unsubscribed

We use the Firebase Java SDK (com.google.firebase:firebase-admin) to send Push Notifications to iOS and Android devices.
We can successfully construct a notification, and send it to a device using the registered FCM token.
On such a device, we opened System Settings, and disabled push notification for the application.
We sent a new notification using FCM, and it did not appear on the device - as expected.
However, we now expect that the Firebase API should throw an Exception, because the FCM token is no longer valid / has been revoked.
We figured it may be cached for a while, but it has now been over 24 hours. We need to be able to fallback to other delivery methods if push has been disabled on a device.
Why does FCM still return 200 OK?
Disabling notifications for the application does not automatically unregister that application with Firebase Cloud Messaging. If you re-enable notifications to that application, the OS will happily deliver notifications again, and it will (as far as I know) continue to use the same token.

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.

Resources