IT tutorials
 
Mobile
 

Windows Phone 8 : Scheduled Notifications (part 1)

4/18/2014 2:25:58 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Sometimes an app may need to schedule a message to be displayed to the user at a future date. One way to achieve this, without relying on the user to have the app open to display the message, is to use a scheduled notification. Scheduled notifications present a dialog to the user at a predefined date and time that provides the user with the following three options:

- A snooze button allows the user to postpone the notification for several minutes. The snooze period can be set by the user when using a reminder.

- A dismiss button allows the user to close the notification.

- Tapping elsewhere within the notification dialog launches your app.

The Windows Phone notification system consists of two types of notifications: alarms and reminders. These provide a simple way to link back to your app and do not depend on your app being in the foreground. Figure 1 shows an alarm being displayed.

Image

FIGURE 1 An Alarm may be snoozed or dismissed by the user.


Note

Tapping an alarm or reminder launches your app. If your app is in the foreground and the user taps the alarm, the alarm dialog is dismissed.


The two types of scheduled notifications are represented by the Alarm and Reminder classes. Both types may be set to be periodic, occurring every day, for example, or set to occur only once.

Registration of a notification is done using the ScheduledActionService class, which is demonstrated later in this section. ScheduledActionService handles the registration of both scheduled notifications and scheduled tasks.


Note

Although scheduled notifications offer an effective and easy way to link back to your app, there is a limit to how many can be registered by your app. This limit is 50 alarms and reminders in total. Attempting to register more than this number raises an InvalidOperationException.


Alarm and Reminder classes are derived from the ScheduleNotification class, which contain a Content property and a Title property that are displayed to the user (see Figure 2).

Image

FIGURE 2 Scheduled notifications class diagram.


Note

The Title property is supported only by the Reminder class and not by the Alarm class. Alarm overrides the Title property, and its setter raises a NotSupportedException if it is used. When the alarm notification is displayed, the title in the alarm dialog is always Alarm.


The most important distinction between alarms and reminders is that reminders allow you to deep link to your app. This means that a URI can be associated with the reminder, so that when the user taps the reminder, your app is launched to a specific page and you can determine the course of action based on the URI’s query string. While tapping an alarm also launches the app, it does not provide an equivalent URI property.

Another distinction between the Alarm and Reminder classes is that the Alarm class includes a Sound property, which allows you to specify the sound file to play when an alarm occurs, which the Reminder class does not.

The time and date of the notification are specified using the ScheduledAction.BeginTime property, which is of type DateTime. The date component of the BeginTime property is relevant only when using a RecurrenceType of None. RecurrenceType defines if, and for what period, scheduled notification should be periodically presented to the user. If the value is None (the default), the notification is raised only once.

When setting the BeginTime property of a notification, the value must fall after the current time or an InvalidOperationException ensues.

The ScheduledAction.ExpirationTime property is used to define the window for which the notification is raised; when the date and time on the phone occur after the ExpirationTime value, the notification schedule expires and the notification is no longer raised. If not specified, ExpirationTime is set to DateTime.MaxValue, resulting in it never expiring.

The following sections examine the use of each notification type in greater detail.

 
Others
 
- Windows Phone 8 : Walking Through the Bookshop Sample Application (part 5) - Overview of the Sample Bookshop WCF Service
- Windows Phone 8 : Walking Through the Bookshop Sample Application (part 4) - Image Caching
- Windows Phone 8 : Walking Through the Bookshop Sample Application (part 3) - Design-Time Data
- Windows Phone 8 : Walking Through the Bookshop Sample Application (part 2) - Displaying the Product List
- Windows Phone 8 : Walking Through the Bookshop Sample Application (part 1)
- Windows Phone 8 : Page Navigation - Creating an Application Splash Screen
- Windows Phone 8 : Page Navigation - Page Redirection, Hardware Back Button
- Windows Phone 8 : Page Navigation - Canceling Navigation, Cross-Page Communication
- Windows Phone 8 : Page Navigation - Navigation Using the NavigationService, Handling Page Navigation
- Windows Phone 8 : Page Navigation - URI Mapping
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us