Im trying to schedule a daily notification with expo notifications. I need to fire this notification from a specified date in the future. So it will be for example: schedule the notification on 20 days in the future and from there fire it daily until cancelled. How can't find anything in the documentation on how to do this. Does anyone have an idea?
Asked
Active
Viewed 474 times
1 Answers
0
You can set a starting date like this:
await Notifications.scheduleNotificationAsync({
content: {
title,
body,
sound: true,
vibrate: [0, 255, 255, 255],
},
trigger: {
date: "your-date"
},
});
Later on you can switch on repeats like this:
trigger: {
repeats: true //or false
},
I'm not sure what you mean by fire until cancelled. Should the user specifically cancel the notification or is som state variable changing? Either way, I think you can add repeats: true or false depending on any variable.
Hope this helps!

jacob
- 15
- 1
- 6
-
What would "repeat" do in this case though? It's set to a date, not an interval. Does repeat always cause a daily repetition to happen? Seems slightly unexpected, although I guess it's the closest thing to making sense. – Brimby Oct 09 '22 at 16:54
-
It would repeat for a given date. Say you want a notification every Tuesday 5pm, then the notification would go out every week, just try playing around and read the expo docs! – jacob Oct 10 '22 at 17:09
-
but the question was about making a notification that starts at an arbitrary date but then repeats daily. Your example "Every Tuesday at 5pm" is a much simpler case than "trigger in 5 days and then repeat daily from there" which is what OP (and I) would like to be able to do. – Brimby Oct 14 '22 at 15:15