anwar
anwar

Reputation: 165

react native - custom expo notifications schedule

I am working on a react-native based mobile app using expo.

in the app the user can set schedules for medication reminders, for that I am using expo-notifications to show those reminders.

expo-notifications provides some functions to schedule notifications, but as I found in the docs it does not provide scheduling options that I need, like every Sunday at 09:00am, or every 2 days at 05:00pm, daily at 08:30pm, and so on...

How can I achieve such scheduling?

Upvotes: 2

Views: 863

Answers (1)

Stanisław Chmiela
Stanisław Chmiela

Reputation: 471

expo-notifications author here! 👋

It depends on your use case, but I would suggest either:

  • use push notifications sent from your backend, where you can design any schedule you like (disadvantage would be that an offline device wouldn't receive the notification and that you'd have to write and maintain that backend)
  • try to work around the limitations
    • every Sunday at X soon will be achievable with WeeklyTrigger
    • every 2 days is tricky, maybe an interval trigger with some offset (not possible right now, but I'll happily review a pull request if you submit one)
    • daily at X is already supported with DailyTrigger
  • submit a pull request adding missing trigger types or adding features to existing ones.

Upvotes: 2

Related Questions