I am creating a Flutter app where I need to allow the user to receive notifications each day at a scheduled time that they set, and the notifications will honour the timezone where the device is.
The notifications will contain dynamic content, rather than static content like one might use to set a reminder. So, I'm assuming that I need to use push notifications and a server-side function to create the dynamic content. For example, using a Firebase Cloud Function and Firebase Cloud Messaging.
What I don't know is how I might get the user's device timezone and the scheduled time they configured for their daily notifications into the Cloud Function.
Is this possible at the time that the device registers with Firebase Cloud Messaging? Or do I need to store the schedule time and timezone in Firestore and somehow pull it from there?
Any other tips for system components that can facilitate this use case would be much appreciated.
Thanks,
Luke
OK, after doing some more research with Dr Google, I found two very good YouTube videos that look like they will do what I need:
https://youtu.be/D4wgrgb24o0
https://youtu.be/I0r10sk5fuI
Thank you to Tadas Petra.
Related
Currently I have a mobile application made with expo and react native and that shows daily weather data, in a graph it shows the data every hour (for example, average temperature). Weather data is taken from a database built on MongoDb. What I want now is that my application during the course of the day, when the temperature exceeds a higher value in the MongoDb database, a push notification is displayed in the mobile application (in production).
What I am thinking is to make an API (either in NodeJS or Python) that is constantly monitoring the database so that when a high value is reached, it sends an alert to the application and finally it can display the push notification. Now I have doubts because, how do I make my application keep listening in the background?
I have heard about firebase and apple push notification (since I am going to make the application on android and ios). Is there a way to not depend on these services?
I just want to know what path I can take and what tools I can use with to achieve what I propose. Monitor the MongoDb database, so that when a value is too high, it sends a push notification to the mobile application (in production).
Thank you all for your answers.
You can run jobs in Nodejs. It checks mongodb every 5 minutes etc. If you have any changes, you can sent push notification using the firebase api.
In the past, I have used Firebase Cloud Messaging to send and receive notifications in my Flutter apps, but it is extremely limited in the notification types and ways to send notifications. I do not want to use Cloud Functions because they are complicated and I don't want to use the POST method because that makes it possible for keys and credentials to get leaked. My idea is to make a collection of notifications in each user Firestore document (which would need to be done anyways for in-app notifications) and then check in the app background for new notifications. Then if there are new notifications I would use awsome_notifications or another package to create customized notifications. I know this is possible when the app is open but cannot figure out how to do it in the background. I found a package https://pub.dev/packages/background_fetch but it seems complicated and I don't see any examples of actual code being called. I'm sure other people have tried something similar so are there any examples?
How can I implement WhatsApp/Telegram like call notification when the flutter app is in the background or cleared from the recent task (clearing ram)? Can anyone let me know Exactly How to do this?
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 you want but I can give a general overview of what you would need to do.
Watch the video/entire series by the CS Guy and complete everything
Learn how to send push notifications in firebase from Fireship
When a new document is created within the calls collection (You will understand once you finish the cs guy series) trigger cloud function.
Find the uid of the receiver of the call within the cloud function and grab the user's token from Firestore.
Finally, send a notification to the receiver telling them about the incoming call.
CS Guy:
https://youtu.be/v9ngriCV0J0
Fireship: https://youtu.be/2TSm2YGBT1s
I have done the exact same thing in my application and can help you out if you need further assistance, however, please go through both videos/series first.
You can use the flutter_local_notifications plugin with the firebase_messaging plugin.
From the documentation of the flutter_local_notifications plugin;
[Android] Support for the following notification styles
Big picture
Big text
Inbox
Messaging
From the documentation of the firebase_messaging plugin;
With this plugin, your Flutter app can receive and process push notifications as well as data messages on Android and iOS.
I'm new to coding and was wondering if anyone had experience with sending out a randomly picked push notification from a list, database, array or whatever with the user being able to control at which time they will receive it. I would preferably automate the process. Thanks for your time and help. I´m currently creating the app for IOS with Swift.
This could be done with UserNotifications in Swift, where the user could set a specific date and time, and then using that for the scheduled notification. I haven't done this before, but this is how I would imagine it's done.
I have an application that it makes requests to a webservice REST created using PHP. It's working perfectly my application makes requests and receive the data. But a want to know how can I make in my application to sincronize in real time with my server. It would be like an application messenger that receives the data automatically without an ask from user. How can I do it? Thanks
Your "real time" and "synchronization" are misleading terms. What you need is the implementation of Push mechanism. You can use cloud messaging from google, see this for details. Or checkout sockets and implement it from the low level yourself
To keep your app synced with your server, run a looping Timer on an interval in the background. Use it to check the server for new messages, and then feed those messages to the user.
Here a is an answer that may help you achieve this Android timer? How-to?.