Scheduling different notifications on each day Flutter

别等时光非礼了梦想. 提交于 2020-05-16 22:00:37

问题


I am a newbie on Flutter. I am developing an app with notifications where notifications will be shown in different parts of the day.

For instance: (3:25 AM, 12:24 PM, 17:22 PM, 19:52 PM, 21:02 PM).

These times will differ based on the day. Times are stored on DB with their corresponding days. These notifications should be displayed even if the app is terminated and not being used.

Problems:

  1. Get new data on around midnight for the new day. (For example around 00:00 AM my app should reschedule all yesterdays' notifications with new times to inform the user with correct data)
  2. I am using flutter_local_notifications to schedule notification. Sometimes it will not fire a notification (if the scheduled time difference is more than 2 hours). That's is why I am going to schedule the soonest notification (for example if notifications should appear 3:25 AM then I want to schedule notifications 30 minutes before). But I am not sure if it is possible.

What I tried.

  1. background_fetch for syncing time with DB but I could not make it work

  2. flutter_local_notifications for showing notifications

Please consider the case that I want to show the notifications even my app is not running or in the background as well as I want to support both Android and iOS

Any help or suggestions are welcome. Thanks in advance


回答1:


If you are using PHP to connect to your database then you can actually use PHP to schedule the time and then send the notification to flutter, just like I did in my application, my application is about sending a notification when the delivery order status change to users, so I created a table in the database and convert it to an API which I call in my flutter application using work manager package and flutter local notification package, would upload the video to youtube this weekend and post the link here for you to see... or can you kindly tell me about your database, what are you using to connect etc

this is the youtube video https://youtu.be/b6CTeqJnmN0



来源:https://stackoverflow.com/questions/61523281/scheduling-different-notifications-on-each-day-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!