Alarm Registration

As previously stated, registering an alarm is done via the ScheduledActionService. When using the ScheduledActionService, each notification must be given a unique name, or an exception is raised when you try to add it to the service. In the following example, we avoid reregistering a notification by detecting whether a notification with the same name has already been registered. We then use the ScheduledActionService class’s Add method to register the alarm, as shown:

Alarm alarm = new Alarm(alarmName){    BeginTime = DateTime.Now.AddDays(1),    Content = "A test alarm.",    RecurrenceType = RecurrenceInterval.None,    Sound = new Uri("/Sounds/Alarm.wma", UriKind.Relative),};if (ScheduledActionService ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.