I want to schedule push notification after some time or say after 2 days 15 hours. So after 2 days 15 hours a notification will be sent to a device.
Is it possible ? How ??
Since a push notification originates from a server and not the phone itself you can schedule anything the provider makes available. You will have to check with your notification service provider what they make available.
However if you just need to schedule a future alert on the phone itself, you can use the UILocalNotification class. This will just kick off a notification on the device once the timer expires.
Related
I have an app that needs to send a reminder notification everyday at a user specified time. For now, I have used flutter_local_notification and used the zoneSchedule method to send a notification locally for that particular day after fetching the time from firebase.
My question is how should I make it so that this notification is sent everyday? When should the scheduling happen.
The specified time can be changed by the user.
I'd like the notification to be sent even when there is no internet connection.
If the app is not in the foreground the app is suspended, so your code wont execute.
You can wake up the app via a push notification from an external source but this will not work if the app has no internet connection.
If you want to execute it without an internet connection, you have to register a background task.
See:
https://docs.flutter.dev/development/packages-and-plugins/background-processes
https://pub.dev/packages/workmanager
Need some design advice for on implementing a push notification system. I am using for the backend Symfony 3, Doctrine and postgres as the database. The notification system will have two types of notifications:
1. Instant notifications
2. Scheduled Notifications
Instant notifications are when an action is performed in the backend and a notification is instantly pushed. For example, a notification when a user is deleted in the database.
Scheduled notifications is for a notification that has not been triggered yet but will at some known time in the future. The notification will only be triggered when it reaches that set time. For example an Alarm clock.
Based on this I have designed simple tables as follows with some mock data:
So with above information the API concept is at user’s device such as mobile phone, it will run a GET/notifications API every 2 mins. The API will return notifications that are before the current date and has not been dismissed for that user. For example, if USER2 executes the GET/notifications with the current date at 18th April 2017 it will return record 3.
My question is this type of design acceptable if not what would be the conventional practice? Also with many users running the same GET API every 2 mins is there a potential to slow down the system? I’m guessing about at most 3000 users.
Finally, as the notifications table grows in records will postgres slow down when performing this API?
Who ever has taken the time to read it all the way through thank you, I am very grateful for any advice.
Push Notification.
If your client devices are asking for notifications via a GET API call, Its not called Push notifications. Down the time, it will be heavy on server side to handle too much unnecessary requests as all users might not have that much notifications.
You shouldn't let your clients call. You should push the notifications to client instead. The iOS and Android apps can be configured to get push notifications through deviceId and uuid. Ask your mobile developers for the same. These days even HTML5 browsers are supporting push notifications.
For storage :
I think you don't have to store instant push notifications in database at all, unless you have an application level requirement to store the logs.
You should only store scheduled notifications so that a Cron job can pick and push those notifications when they are due.
Hope this helps!
I have created a local notification which will fire a notification three times a day.
In afternoon user mobile was dead ,now he will not be able to see his afternoon notification.
By which method i can know that which notification was not delivered and delivering it when user iPhone become on.
I schedule a UILocalNotification at at specific date, and the notification is fired correctly, But the problem is that I receive multiple alerts at random dates for same notification even though the notification is not repeated (repeatInterval = 0 ).
Another note, when I receive the notification at first time , it appears correctly in notification center, but later when I receive the multiple alerts nothing updated in notification center.
Please note that this event is repeated daily, but the notification not get repeated.
Any solution for this issue?
I expect you are never calling:
[[UIApplication sharedApplication] cancelAllLocalNotifications]
These notifications appear to be "old" notifications that haven't been cancelled and are still due to fire. Did you ever have a repeat interval? Some of these notifications could be repeated from very old notifications
I am scheduling a UILocalNotification for an interval. Basically I wanted a notification to be triggered every x days on this app. So the way I did it is to schedule a bunch of notifications at once. So say it's every 2 days, then I do a calculation of the dates every 2 days from now for a year. I am not sure if this is the right and most efficient solution to it, but from researching online, this is what I get I need to do.
The issue is that when the notification fires and I open the app, the badges count goes up to 500, which I think is the number of all future notifications I've scheduled. How is this even possible> Shouldn't the badge only show the number of notifications before the timestamp?
The badge number does not show a number of notifications, but the badge value that you set as notification payload.