1 / 27

Developing Occasionally-Connected Applications for Windows Phone 7

Required Slide. SESSION CODE: WPH306. Developing Occasionally-Connected Applications for Windows Phone 7. Rob Tiffany Mobility Architect Microsoft Corporation. Who am I?. Architect in the Microsoft Mobility Center of Excellence

crystal
Download Presentation

Developing Occasionally-Connected Applications for Windows Phone 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Required Slide SESSION CODE: WPH306 Developing Occasionally-Connected Applications for Windows Phone 7 Rob Tiffany Mobility Architect Microsoft Corporation

  2. Who am I? Architect in the Microsoft Mobility Center of Excellence Created the Microsoft Mobile Line of Business Accelerator for Windows Mobile Writer :: Entrepreneur :: Former Embedded MVP :: Submariner :: Disk Jockey :: Blogger :: Hiker

  3. AGENDAObjectives and Takeaways • Learn how to make your apps “Network-Aware“ • Learn how to build and call RESTfulWCF Web Services • Learn about a new, cross-platform way to Sync with OData • Learn how to build an in-memory database to hold data you’ve retrieved • Learn how to query this in-memory database with LINQ • Learn how to use Isolated Storage as your disconnected data cache • The Key Takeaway is by following these basic principles, you can create a UX that will delight users of your mobile apps regardless of connectivity

  4. NETWORK AWARENESSMaking Decisions based on Data Connections • Mobile apps shouldn’t diminish the user experience by trying to send or receive data in the absence of network connectivity • Mobile apps should be intelligent about performing heavy data transfers or lightweight remote method calls only when the appropriate data connection is available • With Windows Mobile and the .NET Compact Framework, we determined available data connections via the State and Notification Broker • With Windows Phone 7 and Silverlight, we use the NetworkInterfaceType object to detect network type and speed and the NetworkChange object to fire events when the network state changes

  5. Network Awareness Rob TiffanyMobility ArchitectMicrosoft Corporation DEMO

  6. RESTFUL WEB SERVICESBuilding Them • Instead of building “walled gardens,” data should be published in a way that allows it to reach the broadest range of mobile clients • With Windows Mobile, you built SOAP 1.1 Web Services using ASP.NET or Windows Communication Foundation (WCF) with BasicHttpBinding • With Windows Phone 7 and Silverlight, we use WCF both on-premise and as a Web Role in Windows Azure to publish our data from local and cloud-based data sources like SQL Azure • We use lightweight REST + JSON Web Services that are better optimized for high-latency, slow, intermittent wireless data connections

  7. Building RESTful Web Services Rob TiffanyMobility ArchitectMicrosoft Corporation DEMO

  8. RESTFUL WEB SERVICESConsuming Them • Remote data must be easily consumable by any mobile application on Windows Phone 7 or any other mobile platform • With Windows Mobile and the .NET Compact Framework, we used WSDL to help us consume SOAP 1.1 Web Services • RESTful services have no contract to describe interfaces and data types, therefore you will have to document your API • With Windows Phone 7 and Silverlight, we use the WebClient, Uri and DataContractJsonSerializer objects to perform asynchronous operations

  9. Consuming RESTful Web Services Rob TiffanyMobility ArchitectMicrosoft Corporation DEMO

  10. ASYMMETRIC PROTOCOLOData Sync • To further reduce the amount of data exchanged over wireless networks, synchronization technologies ensure that only deltas are exchanged between client and server data sources via change-tracking • With Windows Mobile, we Published data using SQL Server sync technologies like Merge Replication + RDA and Subscribed to that data using SQL Server Compact • With Windows Phone 7 and Silverlight, we use Sync Framework 3.0 and the Asymmetric Protocol to sync with SQL Server and SQL Azure • This cross-platform technology pushes most of the sync logic to the server and uses AtomPub to allow any client to sync with any backend data source

  11. IN-MEMORY DATABASEBuilding It • Occasionally-connected mobile apps only work if you have a local data store • With Windows Mobile and the .NET Compact Framework, we used SQL Server Compact to store our data • With Windows Phone 7 and Silverlight, we create our own database using objects we’ve retrieved from calls to WCF Services • Objects represent rows • Properties represent columns • Collections represent tables • We use a Singleton to cache everything in memory

  12. Building an In-Memory Database Rob TiffanyMobility ArchitectMicrosoft Corporation DEMO

  13. IN-MEMORY DATABASEQuerying It • Mobile application data must be easily retrieved from a local data store • With Windows Mobile and the .NET Compact Framework, we used ADO.NET and SQL to query the local SQL Server Compact database • With Windows Phone 7 and Silverlight, we use LINQ to query our cached collections of objects • SELECT > LINQ retrieves objects with desired data from collection • INSERT > Add object to the collection • UPDATE > Retrieve object from collection and update its properties • DELETE > Remove object from collection

  14. Querying an In-Memory Database Rob TiffanyMobility ArchitectMicrosoft Corporation DEMO

  15. DISCONNECTED DATA CACHEIsolated Storage • Mobile apps must keep working in the absence of a network • With Windows Mobile, data was flushed to a SQL Server Compact database in flash ROM or on an SD card for long-term storage • With Windows Phone 7 and Silverlight, we store data in the protected Isolated Storage area allocated to each app when it’s installed • The IsolatedStorageFile is used to access the application user store • The IsolatedStorageFileStream is used to read and write files • The XmlSerializer or DataContractJsonSerializer is used to serialize/de-serialize collections

  16. Working with Isolated Storage Rob TiffanyMobility ArchitectMicrosoft Corporation DEMO

  17. SUMMARYWhat did we learn? • A new way to determine network connectivity • A different way to publish and consume remote data • A new way to sync data from any client platform to any backend • How to build a mobile database by caching objects in memory • How to use LINQ to query this in-memory object database • How to save and load database objects to and from Isolated Storage

  18. Windows Phone Resources Questions? Demos? The Latest phones? Visit the Windows Phone Technical Learning Center for demos and more… • Business IT Resources www.windowsphone.com/business • Developer Resources developer.windowsphone.com • Experience Windows Phone 7 on-line and get a backstage pass www.windowsphone7.com

  19. Win a Windows Phone Contest Hat Contest* How do you enter? Enter by visiting the Windows Phone booth, accepting a free Windows Phone branded hat, and wearing that hat during the Event. How am I selected? Each day of the event, a Windows Phone representative will randomly select up to 5 people who are observed wearing their Windows Phone branded hat Session Contest* During each Windows Phone session the moderator will post a question. The first person to correctly answer the question and called on by the moderator will potentially win Questions? Go to the WPH Information Counter at the TLC * Restrictions apply please see contest rules for eligibility and restrictions. Contest rules are displayed in the Technical Learning Center at the WPH info counter.

  20. Related Windows Phone Content – Breakout Sessions Mon &Tue Monday WPH301WP7: Deploy Microsoft Forefront Unified Access Gateway for Access Control to SharePoint, Exchange and more. WPH202 Deploying Windows Phone 7 with Exchange Server and SharePoint Server Tuesday WPH203 Overview of the Windows Phone 7 Application Platform WPH313 Windows Phone 7 Architecture Deep Dive WPH304 An In-Depth view at Building Applications for WP7 with Silverlight (Part 1) WPH305 An In-Depth view at Building Applications for WP7 with Silverlight (Part 2) WPH306 Developing Occasionally Connected Applications for Windows Phone 7

  21. Related Windows Phone Content – Breakout Sessions Wed &Thu Wednesday WPH310 Designing and Developing for the Rich Mobile Web WPH311 Developing Mobile Code Today that will run on WP 7 Tomorrow WPH309 Silverlight performance on Windows Phone WPH307 Building Windows Phone Games with XNA WPH308 Building a High Performance 3D Game for Windows Phone Thursday WPH303 Understanding the Windows Phone 7 Development Tools WPH314 Learn Windows Phone 7 Development by Creating a Robotic T-Shirt Cannon WPH312 Understanding Marketplace and Making Money with WP7 Applications

  22. Related Windows Phone Content – Interactive Session & HOL Windows Phone Interactive Sessions Windows Phone 7 Demo Only! Microsoft’s Next Generation Mobile Enterprise Application Platform (MEAP) Windows Phone 7 Application Performance Prepare for Windows Phone 7 Development! Coding practices you should start using now in Windows Mobile Windows Phone Hands On Labs Hello Windows Phone - Building Your first Windows Phone Application Microsoft Silverlight for Windows Phone Microsoft XNA Framework 4.0 for Windows Phones Using Push Notifications and Windows Communication Foundation (WCF) Services

  23. Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn

  24. Required Slide Complete an evaluation on CommNet and enter to win!

  25. Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year

  26. © 2010 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. 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.

  27. Required Slide

More Related