1 / 56

Windows Phone Codename “Mango”

Windows Phone Codename “Mango”. Doug Holland. Sr. Architect Evangelist. Joe Belfiore discusses “mango”. c odename “ Mango”. Agenda: Windows Phone. Cloud and Integration Services. Extras. Calendar Contacts Maps. Push, Alerts. App Model. UI Model. Silverlight and XNA integration. FAS.

diallo
Download Presentation

Windows Phone Codename “Mango”

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. Windows PhoneCodename “Mango” Doug Holland Sr. Architect Evangelist

  2. Joe Belfiore discusses “mango”

  3. codename “Mango” Agenda: Windows Phone Cloud and Integration Services Extras Calendar Contacts Maps Push, Alerts App Model UI Model Silverlight and XNA integration FAS Multitasking Software Architecture Gen GC SQL CE Silverlight 4.0 Hardware Foundation Camera, Sensors & Motion Flexible chassis SoC

  4. Hardware Foundation

  5. Hardware Foundation Updates Capacitive touch 4 or more contact points 800 Motion Sensor Sensors A-GPS, Accelerometer, Compass, Light, Proximity, Gyro Compass Camera Camera 5 mega pixels or more Improved capability detection APIs Multimedia 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 480

  6. Accelerometer +Y • Measures resultant acceleration (force) on device • Pros: • Available on all devices • Cons: • Difficult to tell apart small orientation changes from small device motions -Z -X +X

  7. Camera • Access to live camera stream • PhotoCamera • Silverlight 4 Webcam • Display in your app • Video Brush

  8. When to use each approach PhotoCamera Webcam Record Video Record Audio Share code with desktop Access Samples (Push Model) • Take High Quality Photos • Handle Hardware Button • Handle Flash mode and Focus • Access Samples (Pull Model)

  9. Camera Demo

  10. Gyroscope • Measures rotational velocity on 3 axis • Optional on Mango phones • Not present in pre-Mango WP7 phones

  11. Gyroscope API

  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 phones

  13. Compass API protected override void OnNavigatedTo(NavigationEventArgse){ 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. 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 available

  15. Motion API if (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); … }

  16. Motion Sensor Adapts to Devices • Degraded modes have lower quality approximations • When Motion.IsSupported is false, apps should use accelerometer or other input and control mechanisms

  17. 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 solution

  18. Cloud and Integration Services Software Foundation App Model UI Model Software Foundation Hardware Foundation

  19. Run-time improvements • Silverlight 4 • Features • Performance • Implicit styles • RichTextBox • ViewBox • More touch events (tap, double tap) • Sockets • Clipboard • IME • WebBrowser (IE9) • VideoBrush • Gen GC • Input thread • Working set • Profiler

  20. 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 thread

  21. Sockets Classes in Mango

  22. Coding Sample: TCP Socket Connect _endPoint = newDnsEndPoint(“192.168.0.2", 5000); _socket = newSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); SocketAsyncEventArgsargs = newSocketAsyncEventArgs(); args.UserToken= _socket; args.RemoteEndPoint= _endPoint; args.Completed += newEventHandler<SocketAsyncEventArgs>(OnSocketConnectCompleted); _socket.ConnectAsync(args);

  23. Coding Sample: UDP Socket Client = newUdpAnySourceMulticastClient(address, port); Client.BeginJoinGroup( result => { Client.EndJoinGroup(result); Dispatcher.BeginInvoke( delegate { OnAfterOpen(); Receive(); }); }, null);

  24. 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 input

  25. Local database • SQL Compact Edition • Use object model for CRUD • LINQ to SQL to query, filter, sort • Application level access • Sandboxedfrom other apps • Uses IsolatedStorage • Access for background agents • DatabaseSchemaUpdater APIs for upgrades SQL CE

  26. Database APIs: Datacontext and attributes // Define the data context. publicpartialclassWineDataContext: DataContext { publicTable<Wine> Wines; publicTable<Vineyard> Vineyards; publicWineDataContext(stringconnection) : base(connection) { } } // Define the tables in the database [Table] publicclassWine { [Column(IsPrimaryKey=true] publicstringWineID{ get; set; } [Column] publicstringName { get; set; } …… } // Create the database form data context, using a connection string DataContextdb = newWineDataContext("isostore:/wineDB.sdf"); if (!db.DatabaseExists()) db.CreateDatabase();

  27. Queries: Examples // Find all wines currently at home, ordered by date acquired varq = from w indb.Wines wherew.Varietal.Name == “Shiraz” && w.IsAtHome == true orderbyw.DateAcquired select w; WinenewWine = newWine { WineID = “1768", Name = “Windows Phone Syrah", Description = “Bold and spicy" }; db.Wines.InsertOnSubmit(newWine); db.SubmitChanges();

  28. Cloud and Integration Services Application Model App Model UI Model Software Architecture Hardware Foundation

  29. 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 Mango

  30. Mango Application Lifecycle Fast App Resume Resuming .. . Restore state! IsAppInstancePreserved == false State preserved! IsAppInstancePreserved == true Save State! Tombstoned Tombstone the oldest app Phone resources detached Threads & timers suspended

  31. Multi-tasking design principles Delightful and Responsive UX Battery Friendly Health Never Regret App Install Network Conscience UX Integrated Feel Hardened Services

  32. Multi-tasking Options • Background Transfer Service • Background Audio • Background Agents • Periodic • On Idle • Alarms and Reminders

  33. 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 registration

  34. 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 background

  35. 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)

  36. Generic Agent Types Periodic Agents • Occurrence • Every 30 min • Duration • ~15 seconds • Constraints • <= 6 MB Memory • <=10% CPU On Idle Agents • Occurrence • External power, non-cell network • Duration • 10 minutes • Constraints • <= 6 MB Memory All of this is requirements can change before RTM, but should not change too much

  37. Background Agent Functionality Restricted Allowed • Tiles • Toast • Location • Network • R/W ISO store • Sockets • Most framework APIs • Display UI • XNA libraries • Microphone and Camera • Sensors • Play audio(may only use background audio APIs)

  38. Notifications • Time-based, on-phone notifications • Supports Alerts & Reminders • Persist across reboots • Adheres to user settings • Consistent with phone UX

  39. Alarms vs Reminders? Alarms Reminders • Modal • Snooze and Dismiss • Sound customization • No app invocation • No stacking • Rich information • Integrates with other reminders • Snooze and Dismiss • Launch app • Follows the phones global settings

  40. Alarms API usingMicrosoft.Phone.Scheduler; privatevoidAddAlarm(object sender, RoutedEventArgs e) { Alarmalarm = newAlarm("Long Day"); alarm.BeginTime= DateTime.Now.AddSeconds(15); alarm.Content= "It's been a long day. Go to bed."; alarm.Title= "Alarm"; ScheduledActionService.Add(alarm); } Alarms

  41. Reminders API usingMicrosoft.Phone.Scheduler; privatevoidAddReminder(object sender, RoutedEventArgs e) { Reminderreminder = newReminder("CompanyMeeting"); reminder.BeginTime = DateTime.Now.AddSeconds(15); reminder.Content = "Soccer Fields by The Commons"; reminder.Title = "Microsoft Annual Company Product Fair 2009"; reminder.RecurrenceType = RecurrenceInterval.Yearly; reminder.NavigationUri= newUri("/Reminder.xaml", UriKind.Relative); ScheduledActionService.Add(reminder); } Reminders

  42. 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 Storage

  43. Background Transfer Service API Needs more! usingMicrosoft.Phone.BackgroundTransfer; voidDownloadWithBTS(UrisourceUri, UridestinationPath) { btr= newBackgroundTransferRequest(sourceUri, destinationUri); btr.TransferStatusChanged += BtsStatusChanged; btr.TransferProgressChanged+= BtsProgressChanged; BackgroundTransferService.Add(btr); } voidBtsProgressChanged(object sender, BackgroundTransferEventArgs e) { DrawProgressBar(e.Request.BytesReceived); }

  44. Live Tile improvements • Local Tile APIs • Full control of ALL properties • Multiple tiles per app • Create,Update/Delete/Query • Launches direct to Uri Application Tile Launches main app experience Secondary Tile Launches world news page Secondary Tile Launches local news page

  45. 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 • Flips from front to back at random interval • Smart logic to make flips asynchronous Content Content string is bigger Background Title Title

  46. AppConnect • 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 • Products

  47. New Choosers and Launchers • SaveRingtoneTask • AddressChooseTask • BingMapsTask • BingMapsDirectionsTask • GameInviteTask • Updates: • EmailAddressChooserTask • PhoneNumberChooserTask

  48. Contacts • Read-only querying of contacts • Third party social data cannot be shared • Requires ID_CAP_CONTACTS

  49. Contacts/Appointments Data Shared

  50. Contacts API Contactscontacts = newContacts(); contacts.SearchCompleted+= newEventHandler<ContactsSearchEventArgs>((sender, e) => { ...= e.Results; }); // E.g. search for all contacts contacts.SearchAsync(string.Empty, FilterKind.None, null); state // E.g. search for all contacts with display name matching "jaime" contacts.SearchAsync("jaime", FilterKind.DisplayName, null); filter expression (not a regex) Filter kind: dispay name | email | phone number | pinnedto start)

More Related