Windows Phone Fast App Switching, Tombstoning and Multitasking

0 views

Published on

More info on http://www.techdays.be

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

No Downloads
Views
Total views
0
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
38
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • 5 Windows Phone Fast Application Switching5.1 Execution Model5.2 Application State Management5.3 Fast Application Switching5.4 Tombstoning5.5 Application Navigation and Application Switching
  • Make the point that we are now going to use this diagram to go through the life cycle of an application.
  • This is the test that can be performed during Activation. If the test fails it means that we have to reload everything.
  • This is a recap, the content should have been covered in an earlier module.However, make the point that Isolated storage is available up to the capacity of the phone (at least 8GBytes or so). But it is slow to use and should only be used to persist non volatile data, for example word documents and media etc.State storage is phone memory set aside to hold the state information for dormant or tombstoned applications. This is very fast to use, but the amount available is limited, and it will be discarded if the phone is turned off.
  • If anyone was wondering how come our “runs every half hour” scheduled agent was running so often, this should help explain it.
  • This explains why, when we backed out of the application in the demonstration, Visual Studio did not show the program as running. Instead it was ready to debug the background task.
  • These are not set up and managed in quite the same way as agents, in that we don’t need a separate project.Instead we just create and manage transfer objects that do the work for us.
  • Make the point that these policies are in place to protect performance, battery life and the data allowance of our users. An application that abuses these will not be a popular one.
  • The MSDN example application
  • Make the point that for this reminder there is no recurrence. We are only boiling one egg.This can be set to daily, monthly, end of month and yearly.You can also set an expiration time when the reminder is to stop
  • Make the point that, as with other tasks, even though a reminder has fired it will still exist in the system.If we want to, we can find that reminder and update it, alternatively we can delete the reminder and make a new one.
  • Make the point that the fundamentals are the same for this technology, although the template application is much more fully worked.There is also a very comprehensive example on MSDN.
  • The important point to make is that a background process is not the same as a process running in the background. They are tailored for specific tasks and have constrained abilities and runtime environments.The are as easy to debug as any other application.
  • Windows Phone Fast App Switching, Tombstoning and Multitasking

    1. 1. Follow me on Twitter or the Puppy gets it @benriga
    2. 2. Demo
    3. 3. Fast App ResumeState preserved! runninge.IsApplicationInstancePreserved Save State!== true activated deactivated dormant Phone resources detached Threads & timers suspended
    4. 4. Resuming .. .Restore state!e.IsApplicationInstancePreserved== false running activated deactivated Tombstone the oldest app tombstoned dormant Phone resources detached Threads & timers suspended
    5. 5. 7
    6. 6. private void Application_Activated(object sender, ActivatedEventArgs e){ if (e.IsApplicationInstancePreserved) { // Dormant - objects in memory intact } else { // Tombstoned - need to reload }}
    7. 7. MediaPlayer.Pause MediaElement.Pause SoundEffectInstance.Pause VibrateController.Stop PhotoCamera.Dispose Save page/global stateXNA Audio PausedSensors Notifications suppressedNetworking CancelledSockets DisconnectedMediaElement DisconnectedCamera Disposed
    8. 8. MediaElement.Source/Position/PlaySocket.ConnectAsyncnew PhotoCamera/VideoCameraRestore app state if tombstonedXNA Audio ResumedSensors Notifications resumedNetworking Completed with CancellationSockets -MediaElement -Camera -
    9. 9. 11
    10. 10. Demo
    11. 11. Allowed Restricted Tiles Toast  Display UI Location  XNA libraries Network  Microphone and Camera R/W ISO store  Sensors Sockets  Play audio (may only use background audio APIs) Most framework APIs
    12. 12. Demo
    13. 13. #if DEBUG_AGENT ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(60));#endif
    14. 14. Demo
    15. 15. Demo
    16. 16. Alarms Reminders • Modal • Rich information • Snooze and Dismiss • Integrates with • Sound other reminders customization • Snooze and Dismiss • No app invocation • Launch app • No stacking • Follows the phones global settings
    17. 17. using Microsoft.Phone.Scheduler;...eggReminder = new Reminder("Egg Timer");eggReminder.BeginTime = DateTime.Now + new TimeSpan(0, eggTime, 0);eggReminder.Content = "Egg Ready";eggReminder.RecurrenceType = RecurrenceInterval.None;eggReminder.NavigationUri = new Uri("/EggReadyPage.xaml", UriKind.Relative);ScheduledActionService.Add(eggReminder);
    18. 18. Reminder eggReminder = ScheduledActionService.Find("Egg Timer") as Reminder;if ( eggReminder != null ){ ScheduledActionService.Remove("Egg Timer");}
    19. 19. Demo
    20. 20. http://aka.ms/mbl-phone/starthttp://aka.ms/mbl-phone/toolshttp://aka.ms/mbl-phone/mangohttp://aka.ms/mbl-phone/register
    21. 21. Follow me on Twitter or the Puppy gets it @benriga

    ×