WINDOWS PHONE 7MULTITASKING & BACKGROUND          TASKS Rom an Ivasyshyn   Softj       ourn Inc.
Topics    Platform overview    Multi-Tasking with background agents    Windows Phone Task Manager    Background Notifi...
Platform overview    Intelligent OS and well designed API    Powerful instrumentation and language    Up to date mobile...
Foreground tasks    Normally a windows phone application runs in    the foreground    At any given time one application ...
Background agents    Windows Phone application can start a    background agent.       −   It is PeriodicTask, ResourceInt...
Background Agent restriction    The number of Agents allowed to be active at one time is    restricted by the Windows Pho...
Agent and Tasks    A Task is the container that is managed by the    operation system and runs at the appointed    time ...
Periodic task agent    A periodic task agent runs every       −   Typically every 30 minutes or more, depends on phone   ...
Resource intensive agents    Resource intensive agents run where the    phone is in a position where it can usefully    p...
Dual purpose agent    It is possible for application to perform both    periodic and resource intensive tasks in the    s...
Background and Foregroundcommunication    For Periodic and Resource-intensive Agents:       −   LINQ 2 SQL, file in isola...
Windows Phone Task Manager
File transfer tasks    It is also possible to create a background task    to transfer files to and from your applications...
Background transfer policies    There are a set of policies that control transfer    behavior       −   Maximum Upload fi...
Audio Playback Agent    The audio can be streamed    There are no ability to play music from library    (only from appli...
Conclusion    Use background tasks to perform particular job    DO NOT put any critical logic into yours app    backgrou...
Questions
Upcoming SlideShare
Loading in …5
×

Windows Phone and mobile application development

1,051
-1

Published on

Windows Phone 7 platform overview. Mobile application development for Windows Phone platform basics. Multitasking and services with Phone 7.

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

  • Be the first to like this

No Downloads
Views
Total Views
1,051
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Windows Phone and mobile application development

  1. 1. WINDOWS PHONE 7MULTITASKING & BACKGROUND TASKS Rom an Ivasyshyn Softj ourn Inc.
  2. 2. Topics Platform overview Multi-Tasking with background agents Windows Phone Task Manager Background Notifications File Transfer Tasks, Music Playback Tasks
  3. 3. Platform overview Intelligent OS and well designed API Powerful instrumentation and language Up to date mobile OS WP7 Marketplace now available for Ukraine Multitasking Push notifications Implementation of social network API
  4. 4. Foreground tasks Normally a windows phone application runs in the foreground At any given time one application is running in the foreground This is to ensure the best performance and battery life for the phone user
  5. 5. Background agents Windows Phone application can start a background agent. − It is PeriodicTask, ResourceIntensiveTask or both at same time − There is only one agent allowed per application The agent can run only when the main application is not in the foreground Agent is not equivalent to foreground application running in the background − Its limited in what it can do and the access it has the processor and other phone facilities
  6. 6. Background Agent restriction The number of Agents allowed to be active at one time is restricted by the Windows Phone system If the right conditions do not arise, Agent will not be started − The background agents only run in situations where the system feels able to give them access to the processor If the phone goes into “Power Saver” mode it may stop running background agents completely User can also manage the agents running on their phone and may chose to disable them Dont put any critical logic into yours app background agent
  7. 7. Agent and Tasks A Task is the container that is managed by the operation system and runs at the appointed time It runs an Agent which does the work − The agent code is called as a method in a class − The class is created as part of a Scheduled Task Agent Project There are two kinds of Task − Periodic tasks that are runs through a certain period of time − Resource intensive tasks that run where the phone in a position to let them
  8. 8. Periodic task agent A periodic task agent runs every − Typically every 30 minutes or more, depends on phone loading It is intended to perform a task that should be performed regularly and complete quickly − The agent is allowed to run for 25 seconds or less − The phone sets a limit on the maximum number of active at any time Good for location tracking, polling background services etc.
  9. 9. Resource intensive agents Resource intensive agents run where the phone is in a position where it can usefully perform some data processing − Where the phone is powered by the main − Where the phone is connected to WiFi − Where the phone is not being used (locked screen displayed) A “Resource Intensive”agent can run for up to10 minutes
  10. 10. Dual purpose agent It is possible for application to perform both periodic and resource intensive tasks in the same time This can be achieved using a single background agent class, run from both kind of task The agent will run periodically and when phone is in a position to allow resource intensive work When the agent starts it can determine the context in which it is running and then behave appropriate
  11. 11. Background and Foregroundcommunication For Periodic and Resource-intensive Agents: − LINQ 2 SQL, file in isolated storage that is guarded with a Mutex. − Avoid IsolatedStorageSettings For Audio Agents: Store custom data in the Tag property of the AudioTrack class. Use methods NotifyConplete or Abort to set state flag Toast and Tile notification
  12. 12. Windows Phone Task Manager
  13. 13. File transfer tasks It is also possible to create a background task to transfer files to and from your applications isolate storage The transfers may perform where the application is not running File can be downloaded from HTTP or HTTPS hosts The system maintains a queue of active transfers and services Application can query the state of active transfer
  14. 14. Background transfer policies There are a set of policies that control transfer behavior − Maximum Upload file size: 5Mb − Maximum Download file size over cellular: 20Mb − Maximum Downloads file over WiFi: 100Mb These can be modified by setting the value of TransferPreferences on the particular transfer
  15. 15. Audio Playback Agent The audio can be streamed There are no ability to play music from library (only from applications isolate storage)
  16. 16. Conclusion Use background tasks to perform particular job DO NOT put any critical logic into yours app background agent There are a set of default backgrounds agent designed for common tasks
  17. 17. Questions
  1. A particular slide catching your eye?

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

×