Smart Push Notifications with Flutter & FCM
Why Stack Overflow recommends it
Stack Overflow users link it when answering Flutter questions about sending FCM push notifications, especially triggered from Firestore changes via cloud functions.
Recommended by 3 people across 3 different months, 2019 to 2020.
What it is
A Fireship tutorial showing how to send push notifications in a Flutter app using Firebase Cloud Messaging, targeting a single device, a topic, or a user segment. It walks through the firebase_messaging plugin and triggering messages from Firestore events with cloud functions.
What people said
Strong rec Hudson Kim · 2020-07 · Stack Overflow · on “Implementation of WhatsApp/Telegram like calling feature in Flutter”
There is a great youtube series on this exact topic. In the series, a YouTuber by the name of the CS Guy creates a clone of Skype. I've placed the link to the video where he explains how to create a pop-up screen when a user calls another user, however, you may need to watch the previous videos within the series in order to get everything working. Its quite long but I recommend you watch the entire thing. In terms of displaying notifications when a user is called, I recommend you watch a video by Fireship listed below. In the video, he explains how to send notifications in the background when a certain event occurs in Firestore. I can't explain the entire process in detail to achieve what yo
Recommends Zhangir Siranov · 2019-08 · Stack Overflow · on “Send a notification to a specific user uid in firestore”
Button click is not the best example of trigger for notification, because if it happens locally on device, you can return the notification right from there. More common trigger would be the creation of document in Firestore, that you can monitor by using firebase Admin SDK and Google cloud functions. If you wish to send notifications from there, you will have to get the firebase_messaging plugin in your project, and by getting the device token send it to there. I'm attaching the link for the good video made by fireship. [this video]
Recommends sean.boyer · 2020-06 · Stack Overflow · on “Local Notifications vs FCM: Which is right?”
Indeed, cloud functions were the answer. Once I made myself familiar with building the could functions, it was very easy to set up code to respond to changes in Firestore, and send simple and complex notifications to my users easily. To anyone else looking to implement push notifications, I'd recommend checking out this video: [this video]
Cites Dinesh · 2019-12 · Stack Overflow · on “Push Notification from local server”
If you need push notification on your cell phone then you definitely need to integrate your app with Google Firebase. (or at least that's the right way of doing it). Alternatively, there is something called as local notifications & background process in Android you could do long polling to check if the garage door is open (probably every 2 mins or something). However, I don't recommend that as it can drain your mobile battery. Also I recommend using Flutter [LINK] as oppose to using Native Android. As there are some pre-built libraries for android and Google Firebase integration. Take a look at this Youtube video - [this video]
Cites anonymous-dev · 2020-05 · Stack Overflow · on “Cloud Messaging onMessage callback never gets called when app is in the foreground but onResume and onLaunch do get called?”
I implemented firebase cloud messaging and followed the following tutorial [this video] . And I got it working for the most part. Whenever the app is in the background or closed I get a notification and it will open the app and execute the callback onResume or onLaunch. But I can't seem to get the onMessage callback to work. Whenever the app is in the foreground and I send the notification, the onMessage isn't called? I get the following log to my console E/FlutterFcmService(18141): Fatal: failed to find callback W/FirebaseMessaging(18141): Unable to log event: analytics library is missing W/FirebaseMessaging(18141): Unable to log event: analytics library is missing I have not seen onBackgroundMe