23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

triggers—subject to specific quotas on CPU time and network I/O. As you might expect, an app declares<br />

such background tasks in its manifest.<br />

Triggers include a change in network connectivity, a time zone change, an update of an app, the<br />

expiration of a timer (with a 15-minute resolution), or the arrival of a push notification from an online<br />

source (that is, a notification sent in response to a condition that’s completely external to the device<br />

itself). Each trigger can also be configured with conditions such as whether there is Internet connectivity<br />

or not. Whatever the case, the whole purpose of background tasks is not to launch an app—in fact,<br />

background tasks cannot display arbitrary UI. It is rather to allow them to update their internal state<br />

and, when needed, issue tile updates or toast notifications through which the user can make the choice<br />

to activate the app for further action.<br />

One additional aspect of background tasks is that Windows also places a limit on the total number of<br />

apps that can handle certain kinds of triggers: timers, receipt of push notifications, and receipt of<br />

network traffic on a control channel as used by real-time communications apps. The limit is imposed by<br />

the fact that such apps must be added to the lock screen for their tasks to run at all.<br />

The lock screen, as you certainly know by now and as shown in Figure 13-9, is what’s displayed<br />

anytime the user must log into the device. A device will be locked directly by the user or after a period<br />

of inactivity. An exception is made when an app has disabled auto-locking through the Windows.-<br />

System.Display.DisplayRequest API, as discussed in Chapter 10 in the “Disabling Screen Savers and the<br />

Lock Screen During Playback” section.<br />

FIGURE 13-9 A typical lock screen. Up to seven apps can display badges along the bottom of the screen; one app<br />

can display text next to the clock.<br />

566

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!