Can't get CalendarNotificationTrigger working

Hi,

I’ve been unable to get the CalendarNotificationTrigger from expo-notifications working as described in the docs here: Notifications - Expo Documentation

I’m using the following code - but the notification is not triggered.

let alarm = new Date()
Notifications.scheduleNotificationAsync({
          identifier: notificationID,
          content: {
            title: "One Alarm",
            subtitle: "It's time.",
            sound: "alarm.wav",
          },
          trigger: {
            type:'calendar',
            dateComponents: {
              hour:alarm.getHours(),
              minute:alarm.getMinutes()+1,
            },
            repeats:true
          }
        })

Other trigger techniques, e.g. trigger: <Date> and trigger: null work as expected.

Hope you can help,
Thanks!!
Daniel

Platform: iOS
SDKVersion 39

I’ve spotted the problem, I needed a CalendarNotificationTriggerInput (Notifications - Expo Documentation), not a CalendarNotificationTrigger(Notifications - Expo Documentation).

Code looks like this now:

await Notifications.scheduleNotificationAsync({
          identifier: notificationID,
          content: {
            title: "One Alarm",
            subtitle: "It's time.",
            sound: "alarm.wav",
          },
          trigger: {
            hour:alarmTime.getHours(),
            minute:alarmTime.getMinutes()+1,
            repeats:true
          }
        });

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.