I would like to send a notification in every state (app in background or running) when some data in firebase are changed the database. Do I need to use push notification from firebase?
I use the xxx.keepSync(true) to sync with the firebase db. May I use this detect the change and how can I send the notification in the status bar?
You can use firebase cloud functions.
Refer to firebase documentation for details.
Related
I am creating a framework that can receive custom (a certain data model) messages from firebase. The framework is going to be implemented to receive notifications that are not related with the app but with other stuff.
So the framework is going to handle all the display issue by translating the data received and create a notification as it is indicated (I have some flags in data receive that indicated if I should use an image or attach an icon .. etc).
So I did some research on how to receive messages from FCM.
In first instance, I found direct channel that allows to bypass APNS, the problem is that, this only works with the app in foreground.
I indeed create a test project in firebase, a single view app, register my app in firebase project, set info.plist, configure , and send a notification to my app and It worked (just when the app was open).
Then I looked for another choice, and I found APNS. Skiping all the process for validation between firebase and APNS. I found that when you have all set up (and you put all initialization in didAplicationFinishLaunching) your app is able to receive notifications from firebase (Through APNS) when applicaton is in background.
But, notification received (the one that gets displayed) is just for you to tap over it and then it will fire up the app again an only then you will receive the whole data in aplication:didReceiveRemoteMessage method.
My question is, is there a way I can get this custom messages even in background and when received I can display a notification with the content of the whole message?
Yes,
Fortunately you can do that but for that you need to send Silent Notification which will let you process the notification in background and schedule local notification to trigger it with you desired data.
I have a today extension, and I'm looking for a way to update it by receiving realtime data from remote push notification. Currently my app's using FCM, and I'm trying to receive foreground silent push from FCM and update today extension accordingly. I've tried and searched for a while, didn't find a way, and I'm about to conclude it is impossible. Or is it feasible?
I've write an update flag in shared keychain when I get a specific remote push notification item in UNNotificationServiceExtension and updated widget in repeated timer callback by checking it. Couldn't find better solution.
I'm trying to make the app open automatically when it receive the push notification, i am using Firebase Cloud Messaging and i've already read here about the same problem but i don't quite understand on how to use it for flutter
It's not possible to automatically launch the app once a notification has been received from Firebase Cloud Messaging. As mentioned in the docs, payloads received while the app is in the background can only be handled when the user taps on the notification.
I'm working on an iOS application, and want to achieve behavior like push notifications using firebase real time DB.
In case my app is listening to some firebase node and i'll send local push notification to the user in case that node is updated.
The issue is, if the app is not running i.e. user has killed it, will my app continue listening to that particular node?
I guess, in Android we've support like this, as explained in this link (Link).
Can we achieve the same behavior in iOS. If no, what can be the alternative?
Thanks
Update:
1- There's nothing like triggering push notifications locally in iOS app. I wanted to achieve remote notification's behavior and that can't be done.
2- As far as listening to some event is concerned, it can't be done when app is not in foreground or background.
You can’t do anything if an iOS app is killed/not present in memory.
However, you can do some tasks if app is in background, and is present in memory.
You can use background fetch request in this case.
In Android, there are Services which run even when the app is killed. But on iOS, there is no such thing like this.
You can add Firebase observers in your root view controller, and implement background fetch request to continue observing data when app is in background.
When you app is killed, the listeners are disconnected.
The typical way to send messages to your app in this state is by using a push notification, which in Firebase maps to Firebase Cloud Messaging.
This is why you'll often see the Firebase Database and Firebase Cloud Messaging (FCM) used hand-in-hand: the database is used for messaging while the user has the app open, and FCM is used to send messages when the app is not active.
I want to use firebase but on of the features to this is when the application is in background I want to be notified (maybe create a notification) when the data is changed. Is it possible? Firebase supports this?
iOS has some limitations on this topic, but, I want to know if Firebase SDK support this feature or how i can implement this?
For Android, I think i can use a service to keep data updated and notify the users.
Nope. You'll have to roll your own for that.
See:
Best way to implement push notifications with Firebase
Does firebase handle push notifications?
Using Firebase to send and receive push notification for an iOS app
Real-time Push notifications with Firebase
https://www.quora.com/How-do-you-send-a-push-notification-with-Firebase
https://groups.google.com/forum/#!topic/firebase-talk/NcsozbcxEP4
https://groups.google.com/forum/#!topic/firebase-talk/t1MhR_qhohI