How To: Send scheduled notifications
If you have a scenario in which you want to send a notification at some point in the future, but do not have an easy way to wake up your back-end code to send the notification. Standard tier notification hubs support a feature that enables you to schedule notifications up to seven days in the future.
Schedule your notifications
When sending a notification, simply use the ScheduledNotification
class in the Notification Hubs SDK as shown in the following example:
Notification notification = new AppleNotification("{\"aps\":{\"alert\":\"Happy birthday!\"}}");
var scheduled = await hub.ScheduleNotificationAsync(notification, new DateTime(2014, 7, 19, 0, 0, 0));
Cancel scheduled notifications
Also, you can cancel a previously scheduled notification using its notificationId:
await hub.CancelNotificationAsync(scheduled.ScheduledNotificationId);
There are no limits on the number of scheduled notifications you can send.
Next steps
See the following tutorials:
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for