Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

An end-to-end experience of Windows Phone 7 development (Part 1)


Published on

DevDays 2011 South Africa - An end-to-end experience of Windows Phone 7 development (Part 1)

Published in: Technology
  • Be the first to comment

An end-to-end experience of Windows Phone 7 development (Part 1)

  1. 1.
  2. 2. Rudi Grobler<br /><br />@rudigrobler<br />An end-to-end experience of Windows Phone 7 development<br />TRACK: NEXT GENERATION<br />
  3. 3. agenda<br />
  4. 4. orientation support<br />PhoneApplicationPage.SupportedOrientations property states what orientations the page supports<br />Portrait<br />Landscape<br />PortraitOrLandscape<br />If set to PortraitOrLandscape, page will re-orientate itself automatically when the user rotates the phone<br />You cannot force a page to re-orientate in code<br />You can force a page to always use a specific orientation by setting the SupportedOrientations property to the value you required<br />
  5. 5. Orientation using VSM<br />demo<br />
  6. 6. orientation + SIP<br />SIP takes up more space landscape than portrait<br />vs<br />
  7. 7. system tray and application bar<br />System Tray<br />System owned indicator area that display system-level status information<br />Apps can show/hide<br />Application Bar<br />Area where applications can display buttons for the most common tasks<br />Can display pop-up menu for less common tasks<br />
  8. 8. application bar<br />Use the ApplicationBar instead of creating your own menu system<br />Up to 4 buttons plus optional menu<br />Swipe up the bar to bring up the menu<br />All buttons must specify Text property as well as IconUrl (Changed in Beta)<br />Don’t fill all 4 slots if not needed<br />Use white foreground on transparent background for icons<br />System will colorize button according to users selected theme<br />
  9. 9. Application bar<br />
  10. 10. application bar<br />Page scoped – Search, etc<br />Not for item specific actions like save/delete, rather use the ContextMenu<br />Above SIP<br />
  11. 11. basic application lifecycle<br />
  12. 12. Low Battery<br />a world of interruptions<br />Phone Calls<br />Lock Screen<br />Text Message<br />Reminders<br />Application Switch<br />
  13. 13. Application lifecycle – the problem<br />
  14. 14. moved to background<br />Save state<br />Dormant<br />Tombstoned<br />Restore state<br />Fast switching a.k.a. dormant<br />
  15. 15. application management<br />Windows Phone execution model is designed to provide end users with a fast, responsive experience<br />Only one application can run at a time<br />System terminates application when user navigates away<br />Application is Tombstoned when user navigates away<br />System saves state information then terminates you application<br />When user navigates back to the application system restarts the application and passes state information back<br />Developer must write code to respond to lifecycle events<br />Save and restore state<br />Maintain illusion that the application is running continuously<br />Check if tombstoned (IsAppInstancePreserved)<br />
  16. 16. lifecycle events - application<br />Application_Launching<br />When the application is launching (from start)<br />Not fired when the application is reactivated<br />Application_Activated<br />When application is activated (brought to foreground)<br />Not fired when the application is first launched<br />Application_Deactivated<br />When the application is deactivated (sent to background)<br />Not fired when the application is closing<br />Application_Closing<br />When the application is closing (user hit back)<br />Not fired when the application is deactivated<br />
  17. 17. lifecycle events - page<br />OnNavigateTo<br />OnNavigateFrom<br />
  18. 18. Application lifecycle – the solution<br />
  19. 19. optimizing tombstoning (1)<br />Know whatto save<br />Pivot.SelectedItem<br />TIP: Set in Loaded and NOT NavigateTo<br />Panorama.DefaultItem<br />ScrollViewer position (use ScrollPositionHelper)<br />TextBox.Text<br />ViewModel<br />Whereto save<br />PhoneApplicationService.Current.State[]<br />PhoneApplicationPage.State[]<br />Cache to IsolatedStorage<br />Whento save<br />Application life cycle events<br />Page-level OnNavigateFrom/OnNavigateTo<br />Do not save state on back navigation<br />
  20. 20. optimizing tombstoning (2)<br />Optimize your storage formats<br />DataContractSerializer<br />JSON.NET (MS implementation is VERY slow)<br />XML<br />Binary (More work but VERY fast)<br />MUST rehydrate in less than 10 seconds<br />Defer loading when possible<br />
  21. 21. optimizing tombstoning (3)<br />Release resources<br />Camera, Video, Location, Sensor, etc<br />On rehydrate/activate, remember GPS warm-up time<br />Framework will stop audio, sensors, networking, sockets, MediaElement & camera<br />
  22. 22. Test your tombstoning!!!<br />
  23. 23. phone threading model <br />Touch thread<br />
  24. 24. PerformanceProgressBar<br />“The ProgressBar template for Silverlight that is built into the Windows Phone today has a negative performance cost in ‘indeterminate’ mode (the animating dots that often indicate loading during an operation of unknown time). The control is also known as ‘progress indicator’ according to the UX guidelines for the phone.”<br />Use PerformanceProgressBar (Available in the Silverlight Toolkit for Windows Phone)<br />Read more on Jeff Wilcox’s blog:<br /><br />ProgressIndicator<br />
  25. 25. LowProfileImageLoader<br />“LowProfileImageLoaderis meant to address a very specific scenario: loading lots of images from the web at the same time.”<br />Read more on David Anson’s blog:<br /><br />Image decoding on background thread<br />
  26. 26. Location<br />+ Accuracy<br />- Power<br />- Speed<br />- Indoors<br />- Accuracy<br />+ Power<br />+ Speed<br />- Wilderness<br />+/- Accuracy<br />+/- Power<br />+/- Speed<br />+/- Urban areas<br />Location services<br />WiFi<br />Cell towers<br />
  27. 27. Location<br />
  28. 28. GeoCoordinateWatcher<br />Warm it up<br />Singleton<br />Can be disabled<br />
  29. 29. persistence<br />All IO is restricted to Isolated Storage<br />Create files <br />Manage Settings<br />Ideal for caching data<br />Check out WP7Contrib and AgFx<br />Isolated Storage based Relational DBs<br />Sterling<br />SQLite<br />Structured storage<br />
  30. 30. performance counters<br />Application.Current.Host.Settings.EnableFrameRateCounter= true;<br />
  31. 31. push notifications<br />Server-initiated communication<br />Enable key background scenarios<br />Preserves battery life and user experience<br />Prevents polling for updates<br />
  32. 32. types of notifications<br />Toast<br />Tile<br />Deep toast<br />
  33. 33. Push Notification Architecture<br />Cloud Service<br />Windows Phone 7<br />Push URI to Cloud Service<br />4<br />Push enabled application<br />Push URI request/response<br />1<br />3<br />HTTP Post to URI with payload<br />5<br />Push notification to device<br />Push client service<br />6<br />2<br />Push client/server negotiation<br />MPNS<br />
  34. 34. Scenarios/Popular Applications<br />Weather Apps<br />Chess by Post<br />Send to WP7<br />Weather Tile<br />Warning Toast<br />Turn Tile<br />Move Toast<br />Link Tile<br />Link Toast<br />Beezz<br />Seattle Traffic Map<br />AlphaJax<br />There are hundreds and hundreds of Push apps in Marketplace!<br />Unread Tile<br />Direct Toast<br />Traffic Tile<br />Turn Tile<br />Move Toast<br />
  35. 35. Windows Push Notification Server Side Helper Library<br />“The library provides an easy way for sending all three kinds of push notification messages currently supported by Microsoft Push Notification Services (MPNS): Tile, Toast, and Raw. Our main goal here is to extract any complexity for sending push notification (PN) messages from your website (or web service) to a Windows Phone. This library helps developers to send push messages using only a few lines of code.”<br />Read more on the Windows Phone Developer blog:<br /><br />
  36. 36. don’t re-invent the wheel<br />Control Toolkits<br />PhoneyTools<br />Coding4Fun Toolkit<br />Silverlight Toolkit for Windows Phone<br />WP7Contrib<br />MVVM Toolkits<br />MVVM Light<br />Caliburn.Micro<br />Databases<br />Sterling<br />SQLite<br />AgFx<br />
  37. 37. NuGet<br />
  38. 38. text input<br />TextBoxintegrates with the software keyboard<br />Software keyboard supports input scoping<br />Key InputScopes: <br />EmailNameOrAddress<br />Text<br />Url<br />Number<br />Time<br />TelephoneNumber<br />PasswordBox has a 1 second delay<br />Text Text Revolution: A Game <br />that Improves Text Entry on <br />Mobile Touchscreen Keyboards <br />
  39. 39. Text input<br />
  40. 40. memory constraints<br />Do not use more than 90mb of RAM<br />Use Coding4Fun Toolkit MemoryCounter<br />+/- 30% reduction in working set<br />
  41. 41. Certification checklist<br />No network, no problem?<br /><90MB?<br />Theme aware?<br />Handles exceptions?<br />Back button works as expected?<br />User consent dialogs & settings<br />
  42. 42. Monitor your application<br />Add a “Send Feedback” button<br />Store crash data and ask user to email it<br />Analytics<br />
  43. 43. @rudigrobler<br />Slides, demos, etc…<br /><br />questions<br />
  44. 44. Don’t forget the Xbox Kinectshow-down after sessions this evening!<br />
  45. 45. DevDays 2011 Sponsors<br />PLATINUM SPONSOR<br /><br />SILVER SPONSOR<br /><br />SILVER SPONSOR<br /><br />
  46. 46. Keep in Touch<br /><br />@msdevsa<br /><br />
  47. 47. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />