I know there are methods to check both iOS and Android to see if the user has locally disabled push notifications for an app, that is done within the app itself. But if a user disables push notifications for an app is this reported back to FCM? Does FCM know not to send a notification to that user and if so, is there anyway of pulling that info out of FCM.
The reason for this question is if the user hasn't used the app in a while and they disabled push notifications - without the user starting the app (thus getting updated tokens/checking for permissions) there is no way to know the user disabled push notifications - unless we can extract that from FCM.
And along these same lines, if a user has uninstalled the app, does FCM get updated that the token is now invalid due to app removal and removes it from its db - and if so, is there anyway to way to extract this from FCM?
In both cases, we need to either update our DB that the user has disabled push notifications (and possibly use alternate communication methods) or mark the user as 'uninstalled' and thus remove that user from any app communication method (fcm, sms, email).
Related
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.
For instance, if user uses both phone and tablet to install an app, I will be able to create a device group with these two devices' tokens registered.
However, if the user deletes the app in the tablet without logging out from the app (thus skipping the step of FCM registration token removal workflow during logout), the tablet's FCM token will still remain in the device group in Firebase.
If I continue to use notification key to submit FCM notifications, I wouldn't be able to know that one of the registration token in the device group is invalid.
Is there a way to figure out if any one of the registration token registered in the device group is invalid?
I am asking this question as I am not seeing much benefits of using device group feature in FCM, when I could theoretically manage a list of FCM tokens for each user on my own in a database with full control.
I am working with Firebase to push notifications and I don't use Firebase authentication on my app (I have my own system).
I didn't find an answer to this question:
Is it possible to push notifications to a specific user with firebase without Firebase authentication (and therefore, without a UID)? How?
The push notifications are not sent based on user, they are sent based on push notification token that is received when you register for push notifications (iOS & Android).
The push notification token will change in the case of uninstall/install and has nothing to do with what user is logged in in the app, you can send push notifications to apps that don't have users at all.
In order to target a specific user with push notification, you must do something called user segmentation, that is, filter user based on particular properties of these users. In general user segmentation is done by tracking user action and user properties and depends on the push notification platform in use. For example you can track user actions in the app, like user added product to cart, user has x products in cart and then send a push notification to all users that have more than 3 products in cart.
All the push notifications platform link the push notification token to the events triggered.
If you are using firebase, the most easiest way is to track user properties, there are a lot of tutorials on this part. Although, in my opinion, firebase tracking is kind of crappy.
One thing to note, since the push notification token is not linked to the user directly, in case there are two users (two accounts) using the same device they, they will receive push notifications on the same device, so don't send sensitive information via push notifications.
Is it possible to send permanent notification from firebase cloud functions? User can't dismiss that notification?
For iOS you cannot, but Android you could setup a local notification using remote config.
iOS Remote Notifications
While you could send the same notification over and over again, control of the notifications is at the OS level of the client device. iOS would never let you create a local or remote notification that cannot be dismissed because it would be a poor user experience. In addition, I think you would find that your users would not be happy about it as well.
An alternative, would be to create a custom UI Header in your app that includes a label. You could then use Firebase Remote Config to set a value for that label, that way you can deliver the same message to all users of your app.
Android Push Notifications
In Android, it looks like you can have permanent notifications. However, it looks like this is controlled at the client level. So I still recommend the remote config option here as well. Set the value of the remote config, and then generate a local notification and set the notification to not clear.
notification.flags |= Notification.FLAG_NO_CLEAR;
Perhaps, a key/value pair could be sent from your Firebase Cloud Message call, but you will run into other issues as well. When should the function be called? Will you generate a new notification for every new user added to Firebase? This could become more expensive versus the remote config route.
Google Chrome Notifications
The remote config option should scale to this as well. A quick Google search didn't show anything that would suggest you can do a permanent notification like Android. And even if you could then your solution wouldn't work in Safari and other browsers.
I am writing back end for mobile app, we are sending pushes (something like one user add
another to buddies) he should accept it or decline via push notification(it is required), server got some feedback from notification, and do something.
I am familiar with two techniques about pushes, first I push directly on device using token, second is abstraction when user subscribes for channel and I send push notification on this channel. Id in my application is email, and I suggest to update device token in the database each time user login, and send push on it, but how should I identify device OS ?(IOS/Android)
1) How to scale it, if user have multiple devices, and when user will logout, and login from other device ?
May be there is common solutions for this problem.