Unsubscribe Firebase Push Notifications from unknown devices - firebase

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.

Related

Show notification based on a Firebase values

I want to show notification in my app even if the app is closed.. I don't need Firebase's Push Notification Service. The idea is similar to WhatsApp's message notification service.
When a value is added to firebase by a user another user should receive notification that there is a value change
Can someone tell me how this is done and What should I use to achieve this?
Push notifications for all major apps run through APNS for iOS, and Firebase Cloud Messaging for Android. While the apps may use a higher-level service from their application code, those services depend on APNS and FCM for the actual message delivery.
To see an example of how to build a notification system on top of this, based on values being written to a database, see Send Firebase Cloud Messaging notifications for new followers.

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.

background push notification in ionic3

I have completed an e-commerce app in ionic3. The problem is I want user to be notified when new offers or deals are added in our inventory. This should be a backend process, whether or not the app is open or close.
Note: There is no firebase involved.
If you want to use to get notification in same device then you can try Local notification native plugin for notification and if you want to send notification to other device then you have to use Push or FCM or Onesignal and yes this all required firebase to send push notification to generate device id/key.

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.

Do Firebase Cloud Messaging Data Messages require requestPermission?

I'm trying to understand whether you need to call firebase.messaging().requestPermission() with messages of type Data in Firebase Cloud Messaging.
From what I understand, the data messaging doesn't trigger the standard APN or GCM push notification - thus does it require request permission? It seems like the request permission triggers the standard iOS push notification permission (I haven't tested it on Android yet).
Does that mean that a user will always have a FCM token even if they don't give the app os permissions for push?

Resources