Scheduled Task API Limitations

,

Scheduled task agents do not have access to the entire set of APIs that foreground apps do. There is a set of APIs that are off-limits, and using an API from the set either raises an UnauthorizedAccessException at runtime or causes the app to fail certification during submission to the Windows Phone Marketplace. For the list of unsupported APIs, see Table 32.3.

TABLE 32.3. Scheduled Task Agent Unsupported APIs

Image

One noteworthy limitation is the inability to display visual elements from a background agent. You see a workaround in the next section.

Providing Feedback to the User from an Agent

On occasion, your background agent may want to notify the user of some event. This is not possible using custom UI nor with a MessageBox.

A solution is to use a shell toast, which can provide immediate feedback to the user. A toast notification can be presented from within your task agent like so:

protected override void OnInvoke(ScheduledTask task)
{
    ShellToast toast = new ShellToast
                        {
                            Title = "Windows Phone Unleashed",
                            Content = "Task Scheduler running..."
                        };
    toast.Show();

    /* ... */
}

If the user taps the toast notification, your app is launched in the foreground. By setting the NavigationUri property for the ShellToast, you can also provide a deep link with a query string, as was demonstrated for the to-do item shell tiles.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.187.101