Leveraging Background Services andAgents in Windows Phone 7 (Mango)            Jon Galloway              Microsoft   http:...
We used to just use our phones for onething at a time: talking
Now we expectthem to do a lotof things at once,gracefully…
And we getangry when theydon’t.
Background Audio
Background Audio•   Continues to play when you navigate away•   Uses Zune playlist, Universal Volume Control•   Internet U...
Demo       Audio
Background File Transfer
Background File Transfer - SizeMaximum upload file size              5 MB                                      20 MB – If ...
Background File Transfer - LimitsMaximum outstanding requests in the                                              5 – Tran...
Demo       Background File Transfer
Alarms & Reminders• Demo
Alarms & Reminders• Demo
Alarm•   Displays the Application Name•   Always shows Alarm as the UI title•   Displays text provided by the application•...
Reminder• Displays a title that is provided by the app• Uses the default notification sound• When the user taps the Remind...
Alarms & Reminders• Demo
Demo       Reminders and Alarms
Alarms & Reminders• Demo                     Background                       Agents
Periodic agents run for ashort time on a regular recurringinterval.Examples:● Uploading the device’s location● Small amoun...
Periodic Agent Constraints  Scheduled interval: 30 minutes     • Typically run every 30 minutes, may drift by up to 10    ...
Resource Intensive agents run for arelatively long period of time when thephone meets a set of requirements relatingto pro...
Resource Intensive Agent Constraints  ● Duration: 10 minutes  ● External power required  ● Non-cellular connection require...
Resource Intensive Agent  Might never run on some devices.  Example: User doesn’t have wi-fi access
But that’s not all!  Additional limits for both:  ● Unsupported API’s  ● Memory usage cap: 6MB  ● Reschedule required: 2 w...
Deep Linking From Toast• Demo
ShellToast toast = new ShellToast();toast.Title = "Background Agent Sample";toast.Content = toastMessage;toast.Show();
Launch for Testing
Demo       Background Agents
ShellToast toast = new ShellToast(); toast.Title = "Background Agent Sample"; toast.Content = toastMessage; toast.Show();#...
Recap ● Background Audio ● Background File Transfer ● Scheduled Notifications     • Reminders     • Alarms ●   Scheduled T...
Recap        Background Audio         Background File            Transfer           Scheduled       • Reminders          N...
Thank you!http://weblogs.asp.net/jgalloway@jgallowayJon Galloway | Microsoft
Your Feedback is ImportantPlease fill out a session evaluation form drop it     off at the conference registration desk.  ...
Windows phone background tasks and agents
Windows phone background tasks and agents
Windows phone background tasks and agents
Windows phone background tasks and agents
Windows phone background tasks and agents
Upcoming SlideShare
Loading in...5
×

Windows phone background tasks and agents

23,113

Published on

Slides from my DevConnections 2011 talk covering Background Tasks and Agents in Windows Phone 7.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
23,113
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
42
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • http://msdn.microsoft.com/en-us/library/hh202955(v=VS.92).aspx
  • Alarms and Reminders (Demo)
  • Alarms and Reminders (Demo)
  • Alarms and Reminders (Demo)
  • Alarms and Reminders (Demo)
  • Alarms and Reminders (Demo)
  • http://msdn.microsoft.com/en-us/library/hh202955(v=VS.92).aspx
  • Deep linking from toast notifications (Demo)
  • Transcript of "Windows phone background tasks and agents"

    1. 1. Leveraging Background Services andAgents in Windows Phone 7 (Mango) Jon Galloway Microsoft http://weblogs.asp.net/jgalloway
    2. 2. We used to just use our phones for onething at a time: talking
    3. 3. Now we expectthem to do a lotof things at once,gracefully…
    4. 4. And we getangry when theydon’t.
    5. 5. Background Audio
    6. 6. Background Audio• Continues to play when you navigate away• Uses Zune playlist, Universal Volume Control• Internet URI or Isolated Storage• Implementation ● BackgroundAudioPlayer ● AudioPlayerAgent
    7. 7. Demo Audio
    8. 8. Background File Transfer
    9. 9. Background File Transfer - SizeMaximum upload file size 5 MB 20 MB – If a file exceeds this limit, the TransferPreferences property for theMaximum download size over cellular transfer is automatically changed toconnection AllowBattery, which has the effect of requiring Wi-Fi for the transfer. 100 MB – Files larger than 100 MB must set the TransferPreferences property of the transfer to None or the transfer willMaximum download size over Wi-Fi fail. If you do not know the size of awithout external power transfer and it is possible that it could exceed this limit, you should set the value to None.
    10. 10. Background File Transfer - LimitsMaximum outstanding requests in the 5 – Transfers are not removed from thequeue per application (this includes active queue automatically when they complete.and pending requests).Maximum concurrent transfers across all 2applications on the deviceMaximum queued transfers across all 500applications on the device
    11. 11. Demo Background File Transfer
    12. 12. Alarms & Reminders• Demo
    13. 13. Alarms & Reminders• Demo
    14. 14. Alarm• Displays the Application Name• Always shows Alarm as the UI title• Displays text provided by the application• Application can set alarm sound• The sound begins quietly, gets louder• Tapping Alarm takes user to initial page of app (same as first launch)
    15. 15. Reminder• Displays a title that is provided by the app• Uses the default notification sound• When the user taps the Reminder, the application can provide a navigation URI and query string parameters to which the application will navigate when it is launched
    16. 16. Alarms & Reminders• Demo
    17. 17. Demo Reminders and Alarms
    18. 18. Alarms & Reminders• Demo Background Agents
    19. 19. Periodic agents run for ashort time on a regular recurringinterval.Examples:● Uploading the device’s location● Small amounts of data synchronization
    20. 20. Periodic Agent Constraints Scheduled interval: 30 minutes • Typically run every 30 minutes, may drift by up to 10 minutes. Scheduled duration: 25 seconds • Periodic agents typically run for 25 seconds, may be terminated earlier. Battery Saver mode can prevent execution Per-device periodic agent limit: 6 • User may be warned earlier
    21. 21. Resource Intensive agents run for arelatively long period of time when thephone meets a set of requirements relatingto processor activity, power source, andnetwork connection.Example:● Synchronizing large amounts of data when phone’s not being used.
    22. 22. Resource Intensive Agent Constraints ● Duration: 10 minutes ● External power required ● Non-cellular connection required ● Minimum battery power: 90% ● Device screen lock required ● No active phone call ● Cannot change network to cellular
    23. 23. Resource Intensive Agent Might never run on some devices. Example: User doesn’t have wi-fi access
    24. 24. But that’s not all! Additional limits for both: ● Unsupported API’s ● Memory usage cap: 6MB ● Reschedule required: 2 weeks ● Unscheduled after 2 consecutive crashes
    25. 25. Deep Linking From Toast• Demo
    26. 26. ShellToast toast = new ShellToast();toast.Title = "Background Agent Sample";toast.Content = toastMessage;toast.Show();
    27. 27. Launch for Testing
    28. 28. Demo Background Agents
    29. 29. ShellToast toast = new ShellToast(); toast.Title = "Background Agent Sample"; toast.Content = toastMessage; toast.Show();#if DEBUG_AGENT ScheduledActionService.LaunchForTest( task.Name, TimeSpan.FromSeconds(60));#endif
    30. 30. Recap ● Background Audio ● Background File Transfer ● Scheduled Notifications • Reminders • Alarms ● Scheduled Task • Periodic • Resource Intensive
    31. 31. Recap Background Audio Background File Transfer Scheduled • Reminders Notifications • Alarms • Periodic Scheduled Tasks • Resource Intensive
    32. 32. Thank you!http://weblogs.asp.net/jgalloway@jgallowayJon Galloway | Microsoft
    33. 33. Your Feedback is ImportantPlease fill out a session evaluation form drop it off at the conference registration desk. Thank you!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×