Alarms and reminders are some of the various Windows Phone scheduled notification optionsthat every developer can take advantage of to make his app more responsive and useful. They inherit from ScheduledNotfication and the ScheduledActionService class.In this tutorial we will get to know what an alarm is, what a reminder is and what the differences are between an alarm and the reminder.

Alarms:This is how the alarm looks likein Windows Phone.

Properties:

At a specified time, the alarm dialog box pops up.It consists of:

The app name: the name of the app from which the alarm was created.

“Alarm” is always set as a title.

Content: set by the app or the user.

You can manage the alarm sound from the app.

If the user clicks on snooze the phone will launch automatically the alarm again after 9 minutes.

However if he clicks on the alarm’s UI, the app that created the alarm will be launched at it’s initial page.

2. Reminders:

Properties:

Reminders use the default reminder sound (of the device).

You can edit both the title and the content.

Once the user clicks on the reminder’s UI it’ll open the app or a specific page within the app.

How to add an alarm / a reminder ?

In order to implement alarms and reminders in your project create a new Windows Phone 8 Silverlight Project named “Alarms and Reminders”.

Download Windows Phone Toolkit:

If we want to make our app really useful, then we’d better user some controls that will make the app more practical and user friendly. That’s why we’re going to use the DatePicker and TimePicker controls,which are included in the Windows Phone toolkit.To do so let’s first download the Windows Phone toolkit.In the tools menu click on NuGet Package Manager and Package Manager console.

After some moments the console will appear, write the following command :

And Visual Studio will download the Windows Phone toolkit for you.

Adding Windows Phone Toolkit:

Now let’s add our controls! In the MainPage.xaml add the following xaml code at the top of the page but below the <phone:PhoneApplicationPagestatement:

So we are going to ask the user about the date and time of the notification and we will let him choose whether to use an alarm or a reminder: try to use stackpanels, textblocks , buttons, date and time pickers to make the following UI.First let’s add our textblocksto a stackpanel that has a vertical orientation also add two buttons in a stackpanel with a horizontal orientation.Then we will put both of the stackpanels in a container stackpanel.

//MessageBox.Show(alarmdate.ToString()); just to test wether the alarmdate variable has

//the right value that the user entered

ScheduledActionService.Add(alarm);

}

As for the addReminderButtonclick event, add the same code that we wrote for alarm but just replace the alarm variable with the reminder variable!

Note that you can use the reminder properties to set a title and a navigation Uri if wanted!

Adding a title and a navigation URI to the reminder

C#

1

2

3

reminder.Title="You've got a reminder!";

reminder.NavigationUri=newUri("/MainPage.xaml",UriKind.Relative);//If you want to open your app or a specefic page when

//the user clicks on the reminder UI

Results:

Conclusion:

In this tutorial we learned how to download the Windows Phone toolkit, how to add it to our project and how to use 2 of its controls, the DatePicker and TimePicker, as well.We also usedthose controls to make a small alarm and reminder app which enables the user to set a date and a time for a wanted alarm or reminder. You can download the project sample Here