Chapter 4. Scheduled actions

 

This chapter covers

  • Scheduling reminders
  • Using the DatePicker and TimePicker controls
  • Executing tasks with a background agent
  • Integrating with the Lock Screen

You learned in the last chapter that a dormant application can’t perform any work. How can you create killer applications if they can’t do any work in the background? The answer lies with the Scheduled Action Service. In this chapter you’ll create a sample application to explore alarms, reminders, and background tasks—three different kinds of scheduled actions. Scheduled actions allow your application to alert the user or execute background work when your application isn’t running. Background agents are the mechanisms applications use to perform tasks when an application isn’t running. You can use alarms and reminders to notify a user about important tasks and allow the user to easily restart an application.

As we acknowledge in chapter 3, the multitasking limitations imposed on applications may seem severe to application developers. Microsoft has imposed these limitations to ensure that the user has the best overall experience possible. Background tasks aren’t allowed to affect or slow down foreground application, nor are they allowed to perform tasks that will quickly drain the phone’s battery.

4.1. Working on a schedule

4.2. Introducing the Scheduled Action Service

4.3. Creating a background agent

4.4. Updating the Lock Screen

4.5. Summary