I am working on a Flutter Application that requires to send scheduled notifications.
I was able to create the notification but can't find any documentation on how to update the time and date passed to the scheduled notification?
A solution I thought of was cancelling the notification by searching for it with it's ID but then when I create a new notification with a new ID how do I make sure that ID is not the same as another notification that was scheduled?
For example:
notif1 has id = 12
notif2 has id = 13
now if notif1 is cancelled and a new notification is created with id = 13 wouldn't it overwrite notif2
How do I solve this?
Thanks in advance
Related
I'm making a student organizer app, where I have a module to register the student for an event. Once it has been registered, I want the app to send a notification 10 minutes before the event. How do I proceed with this, since I have no knowledge about it?
P.S., I know I'll have to use flutter-local-notifications, but I don't know how to do it.
Any help would be appreciated!
You don't need to use flutter_local_notifications, you need to use firebase_messaging.
Install the package according to instructions.
Subscribe your users to topics whose names ( topics' names ) will be associated with the name of event so users will receive notifications for that event.
You may push notifications from Firebase console -> Clod messaging.
Here you will create new notification and configure it.
I am making an application using flutter so every teacher has some students in their class so they see their students only in the first screen , I want to send to the teacher notification before each student birthday by 2 days , also i want to send a notification at the beginning of each month (day 1) with all of the birthdays of the students at this month ..
ex: Mark birthday is on 5/9 , Thomas is on 19/9 so i want to send the teacher a notification at day 1 of the month that there is 2 birthdays on this month for Mark and Thomas .
I've searched alot really and i can't do anything .
You have to implement Firebase Messaging or One Signal and need to send notification from the server. You can generate FCM token and then send it to specific devices. Using Pubsub in Firebase Functions you can check daily notification and check if any birthday is coming after 2 days of the following day. If there is Birthday then it will send the notification to the user using the FCM token registered. Here are some resources:
Flutter Firebase Notification using Firebase Functions
Schedule Function using Pubsub and Firebase Functions
I'm working on an ionic project.
If users don't open the application for a long time after downloading my app, I'd like to send them local notification.
For example, I will send a notification if it does not open for 3 days. But I couldn't figure out how.
Can you help me?
You can use the following to send notifications from server:
Create one table in your database to track user activities.
Add columns as userId, lastActivity to store the time of the user's activity.
Update the lastActivity column whenever the user opens the app.
Write one scheduler which will run at a specific time every day.
In the scheduler write a logic to get data from UserActivity table and compare the time stored in the table with your current time.
If the time difference is greater than 3 days then send a notification to that user.
For local notifications here is a way:
Whenever user open's the app schedule the local notification of after 3 days from current date. ( Make sure to remove previously schedule notification before adding new one. )
In this case if user open the app notification will reschedule automatically else notification will fire based on last schedule of it.
You can create a system in which you track user like ,
if user's opens your App then you must update true value for that user with time in your database and now you can compare current time with user's time value and if its more then 3 days you must send notification to that user.
I looked at scheduled_notifications, but it seems I need to create and call a method that actually creates the notification. I am wondering if it is possible to create a scheduled notification without any user interaction.
I would like to add a feature to my social app, which can send a push notification to a specific user, is he's not active.
For exemple, if the user has not logged in for 7 days: I would like to send him a push notification "Hey, it's been a while since you've logged in! Come see the new posts".
I know how to send a push notification to a specific user (that's not the problem), but I don't know how to create an automatic function which is able to know if the user didn't logged in for 7 days.
Do you know if it is possible ?
Ps: I'm using Firebase.
You can use local notification here which is good solution I guess.
Whenever user open's the app schedule the local notification of after 7 days from current date. ( Make sure to remove previously schedule notification before adding new one. )
In this case if user open the app notification will reschedule automatically else notification will fire based on last schedule of it.
I did this way in one app and it worked as I explained.
I think this feature can be executed on the Front-end side. All you need is about Local Notifications. When the user opens the app, you will create a local notification for next 7 days and delete the old one in case user open the app within 7 days.