0

I'm sending now this request:

 '{"data": {"click_action": "FLUTTER_NOTIFICATION_CLICK"} ,"notification": {"body": "${body}", "title": "${title}", "sound": "default"}, "priority": "high", "to": "mytopic"}';

Can I, through some parameter schedule this notification to show only in a given day? for example, I want this notifications arrives in the user phones in 01/02. It is possible?

While searching I found this json:

{ 
 "to": "/topics/discount-offers", 
 "priority": "high",
 "data" : {
  "title" : " Christmas Offer ",
  "message" : "Grab 90% Discount  on Mobile Phones",
  "isScheduled" : "true",
  "scheduledTime" : "2019-12-13 14:12:00"
 }
}

So, I tried to copy "isScheduled" and "scheduledTime" in my project, but it doesn't work.. It continues delivering the message when I send. What can I do to show the notification only in the "scheduledTime"?

This is my json now:

'{"data": {"click_action": "FLUTTER_NOTIFICATION_CLICK", "isScheduled": "true","scheduledTime": "2021-01-26 12:20:00", "title" : "TITLE_HERE","message" : "MESSAGE_HERE",} ,"priority": "high", "to": "myopic"}';

*UPDATE

The notification have to be received in the date selected, in foreground, in background and when the user taps on it, it have to open a given screen. At this moment I'm receiving in foreground, background and redirecting to a given page, BUT, it receives when the message is sent through POST... Have to be delivered in the 'scheduledTime' date/time

  • Why not use flutter local notification they have got you covered for this specific functionality. – basudev nayak Jan 26 '21 at 11:48
  • I have to be able to receive it in background too –  Jan 26 '21 at 11:49
  • You mean you want to navigate when the notification is tapped? – basudev nayak Jan 26 '21 at 11:50
  • The notification have to be received in the date selected, in foreground, in background and when the user taps on it, it have to open a given screen –  Jan 26 '21 at 11:52
  • If you use flutter local notification : The notificaton will be scheduled on the day you specify, You can pass payload and setup flutter local notification as you do for FCM and can navigate from that local notification . The plus side of using flutter local notification is it will be delivered without internet , it will also be shown when the user is using the app – basudev nayak Jan 26 '21 at 12:00
  • The problem is, with Local Notifications, the users that doesn't open the app in that day would not be able to receive the message.. It have to deliver in background too –  Jan 26 '21 at 12:02
  • no theres noting like that, no matter if the user had opened the app or not , if a local notification is scehduled it will definetely get delivered. Are you sending the notification from any other app to the user app ? – basudev nayak Jan 26 '21 at 12:05
  • No, Is one app. But I think you are mixing things here. local notifications only works with the app opened (If I don't open, it dont receive, will receive next time you open). –  Jan 26 '21 at 12:08
  • Who told you that...... https://pub.dev/packages/flutter_local_notifications use this package. Theres noting such like if you opent the app you receive else you don't.. – basudev nayak Jan 26 '21 at 12:10
  • The FCM API tries to deliver messages right after you call it. It has no way to send messages at a specific time. As others have suggested: you could deliver the message right away, and then only display the notification when it is due. See https://stackoverflow.com/questions/39640469/fcm-schedule-delivery-date-or-time-of-push-notification – Frank van Puffelen Jan 26 '21 at 15:45

0 Answers0