A lap around mango


Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • This slide could be presented as “now that we know which sensor might interest you, here’s a more technical description on what each sensor is”
  • Compass demo under Sensors directory..
  • Barcode reader for live stream , or File Sink demo (for video) or PhotoFun for camera (photos) … All under the camera folder in demos..
  • Gyrohas drift ( indicates rotation even when device is stationary)..
  • Sorry, we don’t have one. No Windows Phone 7 phones support this and I don’t have a newer phone 
  • Emphasis on the fact that motion is a very accurate sensor when it comes to device orientation
  • Compass demo under Sensors directory..
  • KEY TAKEAWAY: Use Motion sensor instead of compass or gyro when availableRemember that the motion sensor is good for orientation, not translation. Translation (measuring distance travelled) is still a difficult problem. Why is it more accurate? Compass suffers from great inaccuracies in orientation, often more than 20 degreesCalibration issuesExternal magnetic forcesSignificant lagGyro suffers fromDrift in it’s data (data indicates rotation even when device is stationary)Accelerometer suffers fromDriftMotion sensor algorithm compensates for inaccuracies in each independent sensor.
  • Where applicable,the APIs are compatible with Silverlight on the desktop. SL4 on desktop does not support Unicast. ---Connection Manager is WP component that manages connections on the phone.CM will connect in the following priority order:Desktop passthroughWiFiCellularYou can override this using the Network Preferences APIYou can figure out what type of data network the phone is using: 3G vs EDGE. Etc.
  • Silverlight
  • Chat 2.0 allows you to send text peer to peer using UDP (requires two phones) Shared Pad (also known as Chat Plus allows you to share a drawing pad .. Across IRC sockets is the same demo we demonstrated at MIX keynote. Note that it requires credentials and connecting to a real IRC server.
  • XNA Model Viewer shows XNA models mixed with Silverlight controls (mostly buttons) .. XNA
  • No direct SQL or DDL statements Database is specific to an app ( UI + agents can acesss but no other app can access) DatabaseSchemaUpdater is transactional ..
  • ConstraintsOnly one is active at a time
  • IMDB or MSN Extras or (if showing code) TreyResearch Task..
  • EmailAddressChooser and PhoneNumberChooser now return display name.
  • SaveRingToneTask, BingMapsTask, BingMapsDirectionsTask..
  • A lap around mango

    1. 1. A lap aroundWindows Phonecodename “Mango”Atley Hunter, MCSD, MCDBA, MCPDMVP Windows Phone Development
    2. 2. Agenda: Windows Phone codename “Mango” Extras Calendar Cloud and Contacts Integration Push, Alerts Maps Services FAS Silverlight App UI and XNA Model Model Multitasking integration Software Gen GC SQL CE Architecture Silverlight 4.0 Hardware Camera, Sensors & Motion Foundation SoC Flexible chassis Windows Phone Microsoft Corporation.
    3. 3. Cloud and Integration ServicesHardware App Model UI ModelFoundation Software Foundation Hardware Foundation
    4. 4. Hardware Foundation Updates Capacitive touch 4 or more contact points Sensors Motion Sensor A-GPS, Accelerometer, Compass, Light, Proximity, Gyro Compass Camera Improved 5 mega pixels or more capability Multimedia detection APIs Common detailed specs, Codec acceleration Memory 256MB RAM or more, 8GB Flash or more GPU DirectX 9 acceleration CPU Qualcomm MSM8x55 800Mhz or higher MSM7x30 Hardware buttons | Back, Start, Search Windows Phone Microsoft Corporation.
    5. 5. Accelerometer +Y Measures resultant acceleration (force) on device Pros:  Available on all devices -Z Cons: -X +X  Difficult to tell apart small orientation changes from small device motions5 Windows Phone Microsoft Corporation.
    6. 6. Accelerometerdemo
    7. 7. Camera Access to live camera stream  PhotoCamera  Silverlight 4 Webcam Display in your app  Video Brush7 Windows Phone Microsoft Corporation.
    8. 8. When to use each approach PhotoCamera Webcam  Take High Quality Photos  Record Video  Handle Hardware Button  Record Audio  Handle Flash mode and Focus  Share code with desktop  Access Samples (Pull Model)  Access Samples (Push Model)8 Windows Phone Microsoft Corporation.
    9. 9. Camerademo
    10. 10. Gyroscope Measures rotational velocity on 3 axis  Optional on Mango phones  Not present in pre-Mango WP7 phones10 Windows Phone Microsoft Corporation.
    11. 11. Gyroscope API11 Windows Phone Microsoft Corporation.
    12. 12. Compass (aka Magnetometer) Gives 3D heading of Earth’s magnetic and Geographic North  Subject to external electromagnetic influences  Requires user calibration over time  Great inaccuracies in orientation, up to 20 degrees  Significant lag Availability:  Optional on “Mango” phones  Included in some pre-Mango WP7 phones13 Windows Phone Microsoft Corporation.
    13. 13. Compass API protected override void OnNavigatedTo(NavigationEventArgs e){ if (Compass.IsSupported) { compass = new Compass(); compass.CurrentValueChanged += compass_CurrentValueChanged; compass.Start() } } private void compass_CurrentValueChanged(object sender, SensorReadingEventArgs<CompassReading> e) { Deployment.Current.Dispatcher.BeginInvoke(() => { CompassRotation.Angle = -e.SensorReading.TrueHeading; Heading.Text = e.SensorReading.TrueHeading.ToString("0 "); }); }14 Windows Phone Microsoft Corporation.
    14. 14. Compassdemo
    15. 15. Motion Sensor Virtual sensor, combines gyro + compass + accelerometer Motion Sensor vs. gyro or compass or accelerometer  More accurate  Faster response times  Comparatively low drift  Can disambiguate motion types Has fall-back if gyro is not available Always prefer Motion Sensor when available16 Windows Phone Microsoft Corporation.
    16. 16. Motion APIif (Motion.IsSupported) { _sensor = new Motion(); _sensor.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<MotionReading>>(sensor_CurrentValueChanged); _sensor.Start();}void _sensor_CurrentValueChanged(object sender, SensorReadingEventArgs<MotionReading> e){ Simple3DVector rawAcceleration = new Simple3DVector( e.SensorReading.Gravity.Acceleration.X, e.SensorReading.Gravity.Acceleration.Y, e.SensorReading.Gravity.Acceleration.Z); …}17 Windows Phone Microsoft Corporation.
    17. 17. Motion Sensor Adapts to DevicesAccelerometer Compass Gyro MotionYes Yes Yes FullYes Yes No DegradedYes No Yes UnsupportedYes No No Unsupported  Degraded modes have lower quality approximations  When Motion.IsSupported is false, apps should use accelerometer or other input and control mechanisms18 Windows Phone Microsoft Corporation.
    18. 18. Sensor Calibration Calibration Event is fired when calibration is needed  Both Compass and Motion sensors need user calibration Apps should handle it  Provide UI asking user to move device through a full range of orientations  Not handling will cause inaccurate readings  We are considering providing copy & paste solution19 Windows Phone Microsoft Corporation.
    19. 19. Cloud and Integration ServicesSoftware App Model UI ModelFoundation Software Foundation Hardware Foundation
    20. 20. Run-time improvements Silverlight 4 Features Performance• Implicit styles • Sockets • Gen GC• RichTextBox • Clipboard • Input thread• ViewBox • IME • Working set• More touch • WebBrowser • Profiler events (IE9) (tap, double • VideoBrush tap)21 Windows Phone Microsoft Corporation.
    21. 21. Networking Sockets  TCP  UDP unicast, Multicast ( on Wi-Fi) Connection Manager Control  Overrides and sets preferences (e.g. Wi-Fi or cellular only) HTTP  Full header access  WebClient returns in originating thread22 Windows Phone Microsoft Corporation.
    22. 22. Socketsdemo
    23. 23. Silverlight and XNA Shared Graphics XNA inside Silverlight App Integration at Page Level  XNA takes over rendering Integration at Element level  Silverlight elements in XNA pipeline via UIElementRenderer Shared input27 Windows Phone Microsoft Corporation.
    24. 24. Silverlight +XNA demo
    25. 25. Local database SQL Compact Edition  Use object model for CRUD  LINQ to SQL to query, filter, sort Application level access  Sandboxed from other apps  Uses IsolatedStorage  Access for background agents DatabaseSchemaUpdater APIs SQL CE for upgrades29 Windows Phone Microsoft Corporation.
    26. 26. Database APIs: Datacontext and attributes // Define the data context.public partial class WineDataContext : DataContext{ public Table<Wine> Wines; public Table<Vineyard> Vineyards; public WineDataContext(string connection) : base(connection) { }}// Define the tables in the database[Table]public class Wine{ [Column(IsPrimaryKey=true] public string WineID { get; set; } [Column] public string Name { get; set; } ……}// Create the database form data context, using a connection stringDataContext db = new WineDataContext("isostore:/wineDB.sdf");if (!db.DatabaseExists()) db.CreateDatabase(); Windows Phone Microsoft Corporation.
    27. 27. Queries: Examples// Find all wines currently at home, ordered by date acquiredvar q = from w in db.Wines where w.Varietal.Name == “Shiraz” && w.IsAtHome == true orderby w.DateAcquired select w;Wine newWine = new Wine{ WineID = “1768", Name = “Windows Phone Syrah", Description = “Bold and spicy"};db.Wines.InsertOnSubmit(newWine);db.SubmitChanges(); Windows Phone Microsoft Corporation.
    28. 28. Local databasedemo
    29. 29. Cloud and Integration ServicesApplication App Model UI ModelModel Software Architecture Hardware Foundation
    30. 30. Fast Application Resume Immediate Resume of recently used applications  Apps stay in memory after deactivation New “task switcher”  Long-press back button While dormant  Apps are not getting CPU cycles  Resources are detached You must recompile and resubmit targeting Mango34 Windows Phone Microsoft Corporation.
    31. 31. Mango Application Lifecycle Fast App Resume Resuming .. . Restore state!State preserved! running IsAppInstancePreservedIsAppInstancePreserved == Save State! == falsetrue activated deactivated Tombstone Tombstoned dormant Phone resources detached the oldest Threads & timers suspended app Windows Phone Microsoft Corporation.
    32. 32. Fast App Resumedemo
    33. 33. Multi-tasking design principles Delightful and Battery Responsive UX Friendly Health Never Regret Network App Install Conscience Integrated Feel UX Hardened Services39 Windows Phone Microsoft Corporation.
    34. 34. Multi-tasking Options Background Transfer Service Background Audio Background Agents  Periodic  On Idle Alarms and Reminders40 Windows Phone Microsoft Corporation.
    35. 35. Background Audio Playback  App provides URL or stream to Zune  Audio continues to play even if app is closed  App is notified of file or buffer near completion Phone Integration  Music & Video Hub  Universal Volume Control (UVC), lauch app, controls, contextual info  Contextual launch – Start menu, UVC, Music & Video Hub App Integration  App can retrieve playback status, progress, & metadata  Playback notification registration41 Windows Phone Microsoft Corporation.
    36. 36. Background Audio App Types URL PlayList  Provide URL to play  Pause, resume, stop, skip-forward, skip-backward Stream Source  Provide audio buffers  Custom decryption, decompression Requires app to run some code in background42 Windows Phone Microsoft Corporation.
    37. 37. Background Agents Agents  Periodic  On Idle  An app may have up to one of each Initialized in foreground, run in background  Persisted across reboots User control through CPL  System maximum of 18 periodic agent Agent runs for up to 14 days (can be renewed)44 Windows Phone Microsoft Corporation.
    38. 38. Generic Agent TypesPeriodic Agents On Idle Agents Occurrence  Occurrence  Every 30 min  External power, non-cell network Duration  Duration  ~15 seconds  10 minutes Constraints  Constraints  <= 6 MB Memory  <= 6 MB Memory  <=10% CPUAll of this is requirements can change before RTM, but should not change too much45 Windows Phone Microsoft Corporation.
    39. 39. Background Agent Functionality Allowed Restricted  Tiles  Display UI  Toast  XNA libraries  Location  Microphone and Camera  Network  Sensors  R/W ISO store  Play audio  Sockets (may only use background audio APIs)  Most framework APIs46 Windows Phone Microsoft Corporation.
    40. 40. Agentdemo
    41. 41. Notifications Time-based, on-phone notifications Supports Alerts & Reminders Persist across reboots Adheres to user settings Consistent with phone UX48 Windows Phone Microsoft Corporation.
    42. 42. Alarms vs Reminders?Alarms Reminders • Modal • Rich information • Snooze and Dismiss • Integrates with other reminders • Sound customization • Snooze and Dismiss • No app invocation • Launch app • No stacking • Follows the phones global settings49 Windows Phone Microsoft Corporation.
    43. 43. Alarms & remindersdemo
    44. 44. Background Transfer Service Start transfer in foreground, complete in background, even if app is closed Queue persists across reboots  Queue size limit = 5  Queue APIs (Add, Remove, Query status) Single service for many apps, FIFO Download ~20 MB ( > over Wi-Fi) Upload Size ~4 MB (limit to come) Transfers to Isolated Storage53 Windows Phone Microsoft Corporation.
    45. 45. Cloud and Integration ServicesIntegration App Model UI ModelServices Software Architecture Hardware Foundation
    46. 46. Live Tile improvements Local Tile APIs  Full control of ALL properties Multiple tiles per app  Create,Update/Delete/Query  Launches direct to Uri56 Windows Phone Microsoft Corporation.
    47. 47. Live Tiles – Local Tile API Continued… Back of tile updates  Full control of all properties when your app is in the foreground or background  Content, Title, Background Content Content string is Background bigger Title Title  Flips from front to back at random interval  Smart logic to make flips asynchronous Windows Phone Microsoft Corporation.
    48. 48. Live tilesdemo
    49. 49. Push Notifications (Core) Enhancements Reliability Efficiency Performance• New TDET • TLS resume for • Faster state mechanism for sessions within 8 machine for faster broader network hours client service compatibility • Hints for • Smarter queue• Lowered polling improved radio logic for less interval for non- dormancy redundancy persistent • Concurrent tile connection downloads for less friendly networks radio uptime59 Windows Phone Microsoft Corporation.
    50. 50. Push Notifications – New Features! MultiTile/Back of Tile Support  Can update all tiles belonging to your application  No API Change! – BindToShellTile now binds you to all tiles  Send Tile ID to service and use new attribute to direct update  3 new elements for back properties: BackBackgroundImage, BackContent, BackTitle Deep Toast  Take users directly to an application experience  Uses standard SL navigation (OnNavigatedTo)  No API change! – BindToShellToast still all you need.  New element to send query parameters with a toast: Param Windows Phone Microsoft Corporation.
    51. 51. Extras Integration point between Bing Search and 3rd party apps User launches 3rd party from Bing Search – search parameter is passed to the app Four item types:  Movies  Places  Events  Products61 Windows Phone Microsoft Corporation.
    52. 52. New Choosers and Launchers SaveRingtoneTask AddressChooseTask BingMapsTask BingMapsDirectionsTask GameInviteTask Updates:  EmailAddressChooserTask  PhoneNumberChooserTask63 Windows Phone Microsoft Corporation.
    53. 53. Contacts Read-only querying of contacts Third party social data cannot be shared Requires ID_CAP_CONTACTS65 Windows Phone Microsoft Corporation.
    54. 54. Calendar Read-only querying of calendar appointments Returns a snapshot (not live data)  You must refresh manually Requires ID_CAP_APPOINTMENTS69 Windows Phone Microsoft Corporation.
    55. 55. Appointments APIAppointments appointments = new Appointments();appointments.SearchCompleted += newEventHandler<AppointmentsSearchEventArgs>((sender, e) => { ... = e.Results; }); Start date and time// get next appointment (up to 1 week away)appointments.SearchAsync(DateTime.Now, DateTime.Now + TimeSpan.FromDays(7), 1, null); end date and time Maximum items to return state Windows Phone Microsoft Corporation.
    56. 56. What are Search Extras? Added functionality 3rd party apps provide for Bing items Four item types:  Movies  Places  Events  Products Windows Phone Microsoft Corporation.
    57. 57. Three Easy Steps to Implement Search Extras1. Update your app’s Manifest  Use the Extensions element  One child Extension element for each category your app supports  Your app will appear in those items!  This is a great way to drive downloads if your app isn’t yet installed2. Add an Extras.XML file to your XAP  Specify captions for each Bing category3. Accept Context to automatically open the item in your app  Create a SearchExtras page that accepts parameters.  Search for the item using the parameters passed to your app. Windows Phone Microsoft Corporation.
    58. 58. Call to Action Download the tools at http://create.msdn.com 7.5 allows you to build deeply integrated phone experiences – build them into your apps! Multitasking opens up completely new experiences Integration points are a key way for your app to shine73 Windows Phone Microsoft Corporation.
    59. 59. Atley Hunter, MCSD, MCDBA, MCPDMVP Windows Phone DevelopmentTwitter: @atleyhunterBlog: www.atleyhunter.com
    60. 60. © 2011 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.75 Windows Phone Microsoft Corporation.