Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Phone Development Tomer Shamam Senior Architect Sela Group.

Similar presentations


Presentation on theme: "Windows Phone Development Tomer Shamam Senior Architect Sela Group."— Presentation transcript:

1 Windows Phone Development Tomer Shamam Senior Architect Sela Group

2 Windows Phone Microsoft Corporation. Agenda: Windows Phone  General Concept  Software and UI Architecture  Application Model  Data Services  Integration Services  Multitasking  Devices and Sensors  Communication  Deployment and Marketplace

3 General Concept

4 Windows Phone Microsoft Corporation. New Concept 4 DESIGN: END USER COMES FIRST PLATFORM: RICHER, DEEPER, EASIER APPS HARDWARE: FASTER TO MARKET, LESS HEAVY LIFTING

5 Windows Phone Microsoft Corporation. Life Maximizers

6 Windows Phone Microsoft Corporation. Metro UI 6

7 Windows Phone Microsoft Corporation. Hardware Foundation Capacitive touch 4 or more contact points Sensors A-GPS, Accelerometer, Compass, Light, Proximity, Gyro (optional) Camera 5 mega pixels or more 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 Hardware buttons | Back, Start, Search

8 Windows Phone Microsoft Corporation. Windows Phone Application Platform 8 SensorsMediaData Xbox LIVENotifications.NET Framework managed code sandbox Location Phone Runtime – On “ Screen ” Phone Emulator SamplesDocumentation GuidesCommunity Packaging and Verification Tools Tools Registration Validation Certification Publishing Marketplace MO and CC Billing Business Intelligence Update Management Portal Services Notifications LocationIdentityFeeds MapsSocial App Deployment Cloud Services

9 Windows Phone Microsoft Corporation. Windows Phone Developer Tools 9 Windows Phone device Windows Phone Emulator Phone Emulator SamplesDocumentation GuidesCommunity Packaging and Verification Tools Tools

10 Software and UI Architecture

11 Windows Phone Microsoft Corporation. Silverlight 4 Capabilities  Inputs  Keyboard, Mouse, Touch, Ink  XAML UI Core  Common Controls, Text, Images, Data Binding, Page Navigation, Vector Graphics, Animation, Transformation, Styles and Templates  Media  Capture and Playback, VC1, WMA, MP3  Data  LINQ to Objects, LINQ to XML, Isolated Storage, XML, OData  Base Class Library  Generics, Collections, Cryptography, Threading  Communication  REST, RSS/ATOM, SOAP 11

12 Windows Phone Microsoft Corporation. Multitouch  OOB Controls support touch  Translate touch events to mouse events  ScrollViewer has built-in support for pan and flick  Manipulation for all UIElements  Scale  Translate  Raw Touch, compatible with SL4  Touch Events (tap, double tap) 12

13 Windows Phone Microsoft Corporation. Keyboard  Silverlight TextBox integrates with the SIP (on screen keyboard)  Password has a delay  SIP supports input scoping  Key InputScopes: Text, Url, Number, Time, TelephoneNumber, EmailNameOrAddress 13

14 Windows Phone Microsoft Corporation. Media 14  Media support  H/W decode  MediaStreamSource  PlayReady DRM  MediaElement Limitations  One MediaElement only  XNA sound effect API  Supports polyphonic, looping wav data

15 Windows Phone Microsoft Corporation. Application Bar and System Tray  System Tray  No integration, but does affect Layout  Show:Hide using SystemTray.IsVisible  Application Bar  Up to 4 Buttons  Menu Items (Recommended 6)  Toggle Visibility .ApplicationBar.IsVisible 15

16 Windows Phone Microsoft Corporation. Panorama 16  Part of the native Windows Phone look and feel  Panorama is a long horizontal canvas  PanoramaItem serves as a container that hosts other content and controls

17 Windows Phone Microsoft Corporation. Pivot 17  Provides a quick way to manage views or pages  Pivot is a container of pivot items  PivotItem contain individual page content such as controls, grids, or links

18 Windows Phone Microsoft Corporation. more…  Standard Controls  Buttons, Image, Layout, ListBox, TextBox, Slider, Other…  Bing Maps  Bing Map Control, Integration with Bing Maps Services  Deep Zoom  Included in core run-time, Optimized to take advantage of GPU, Consumes same content as SL on desktop, Supported for Online content  Web Browser  Displays network and local content, Supports pan, double tap and pinch to zoom, Supports transforms & projections, Application can interact with javascript 18

19 Windows Phone Microsoft Corporation. Even more… (Silverlight Toolkit)  AutoCompleteBox, ContextMenu, DatePicker DateTimeConverters, DatePicker, ExpanderView GestureService/GestureListener, HeaderedItemsControl HubTile, ListPicker, LocalizedResources, LockablePivot LongListSelector, MultiselectList, Page Transitions PerformanceProgressBar, PhoneTextBox, TiltEffect TimePicker, ToggleSwitch, WrapPanel  Download at http://silverlight.codeplex.comhttp://silverlight.codeplex.com 19

20 Windows Phone Microsoft Corporation. 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 20

21 Windows Phone Microsoft Corporation. MVVM  MVVM Light Toolkit  http://mvvmlight.codeplex.com/ http://mvvmlight.codeplex.com/  Caliburn Micro  http://caliburnmicro.codeplex.com/ http://caliburnmicro.codeplex.com/  Prism  http://msdn.microsoft.com/en- us/library/ff648465.aspx http://msdn.microsoft.com/en- us/library/ff648465.aspx  Others… 21

22 Software Model demo

23 Application Model

24 Windows Phone Microsoft Corporation. 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 24

25 Windows Phone Microsoft Corporation. Activation and Navigation  Activation Events  Handled by the Application instance  Launching, Activated, Deactivated and Closing  Navigation Events  Handled by each PhoneApplicationPage class  OnNavigatedTo, OnNavigatedFrom, OnBackKeyPressed, OnChooserReturn, OnOrientationChanged  Controlled by  Hardware using Back and Home keys  Software using Navigation Service 25

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

27 Windows Phone Microsoft Corporation. Deactivation Resource Management MediaPlayer.Pause MediaElement.Pause SoundEffectInstance.Pause VibrateController.Stop PhotoCamera.Dispose Save page/global state XNA AudioPaused SensorsNotifications suppressed NetworkingCancelled SocketsDisconnected MediaElementDisconnected CameraDisposed

28 Windows Phone Microsoft Corporation. Activation Resource Management MediaElement.Source/Position/Play Socket.ConnectAsync new PhotoCamera/VideoCamera Restore app state if tombstoned XNA AudioResumed SensorsNotifications resumed NetworkingCompleted with Cancellation Sockets- MediaElement- Camera-

29 Application Model demo

30 Data Services

31 Windows Phone Microsoft Corporation. Isolated Storage  Compatible APIs with Silverlight on desktop  No quota limits  Not shared  No write access to Media Library, use XNA for that  Use for your application settings 31

32 Windows Phone Microsoft Corporation. Contacts  Read-only querying of contacts  Third party social data cannot be shared  Requires ID _ CAP _ CONTACTS 32

33 Windows Phone Microsoft Corporation. Code Sample: Contacts 33 Contacts contacts = new Contacts(); contacts.SearchCompleted += new EventHandler ((sender, e) => {... = e.Results; }); // E.g. search for all contacts contacts.SearchAsync(string.Empty, FilterKind.None, null); filter expression (not a regex) Filter kind: dispay name | email | phone number | pinnedto start) state // E.g. search for all contacts with display name matching "jaime" contacts.SearchAsync("jaime", FilterKind.DisplayName, null);

34 Windows Phone Microsoft Corporation. Calendar  Read-only querying of calendar appointments  Returns a snapshot (not live data)  You must refresh manually  Requires ID _ CAP _ APPOINTMENTS 34

35 Windows Phone Microsoft Corporation. Code Sample: Appointments Appointments appointments = new Appointments(); appointments.SearchCompleted += new EventHandler ((sender, e) => {... = e.Results; }); // get next appointment (up to 1 week away) appointments.SearchAsync(DateTime.Now, DateTime.Now + TimeSpan.FromDays(7), 1, null); Start date and time Maximum items to return state end date and time

36 Windows Phone Microsoft Corporation. Local database  SQL Compact Edition  Object Model for CRUD  LINQ to SQL to query, filter, sort  Application scope  Uses IsolatedStorage  DatabaseSchemaUpdater APIs for upgrades 36

37 Data Services demo

38 Integration Services

39 Windows Phone Microsoft Corporation. Live Tile  Local Tile APIs  Full control of ALL properties  Multiple tiles per app  Create,Update/Delete/Query  Launches direct to Uri 39

40 Windows Phone Microsoft Corporation.  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 Live Tiles – Local Tile API Continued… Title Content Title Background Content string is bigger

41 Live tiles demo

42 Windows Phone Microsoft Corporation. Launchers & Choosers  Enable applications to provide a set of common phone tasks to their users  Launchers let you fire and forget  SMS, Email, Web Browser, Dialer, Search, etc.  Choosers let you fire and pick the results back  Picture, Camera, Contact, etc. 42

43 Launchers & Choosers demo

44 Multitasking

45 Windows Phone Microsoft Corporation. Multi-tasking design principles 45 Network Conscience Battery Friendly Hardened Services Delightful and Responsive UX Never Regret App Install Integrated Feel UX Health

46 Windows Phone Microsoft Corporation. Multi-tasking Choices  Background Transfer Service  Background Audio  Background Agents  Periodic  Resource Intensive  Alarms and Reminders 46

47 Windows Phone Microsoft Corporation. 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), launch app, controls, contextual info  Contextual launch – Start menu, UVC, Music & Video Hub  App Integration  App can retrieve playback status, progress, & metadata  Playback notification registration 47

48 Windows Phone Microsoft Corporation. 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 48

49 Background Audio demo

50 Windows Phone Microsoft Corporation. Background Agents  Background Agent  Allows an application to execute code in the background  Two types of background processing scenarios: tasks: Periodic and Resource Intensive  Application may have only one background agent  Initialized in foreground, run in background  Persisted across reboots  Scheduled Tasks  Periodic task runs regularly for a small amount of time  Resource Intensive task runs occasionally and is allowed to use substantial device resources  User control through CPL  System maximum of 18 periodic agents  Agent runs for up to 14 days (can be renewed) 50

51 Windows Phone Microsoft Corporation. Agent Types 51 Periodic  Occurrence  Every 30 min, non battery saver  Duration  ~15 seconds  Memory Constraints  <= 5 MB Memory Resource Intensive  Occurrence  External power or battery > 90%, screen lock, no-call, no-cell  Duration  10 minutes  Memory Constraints  <= 5 MB Memory All of this requirements can change before RTM, but should not change too much

52 Windows Phone Microsoft Corporation. Background Agent Functionality 52 Allowed  Tiles  Toast  Location  Network  R/W ISO store  Sockets  Most framework APIs Restricted  Display UI  XNA libraries  Microphone and Camera  Sensors  Play audio

53 Background Agent demo

54 Windows Phone Microsoft Corporation. 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 54

55 Windows Phone Microsoft Corporation. Code Sample: Background Transfer 55 using Microsoft.Phone.BackgroundTransfer; void DownloadWithBTS(Uri sourceUri, Uri destinationPath) { btr = new BackgroundTransferRequest(sourceUri, destinationUri); btr.TransferStatusChanged += BtsStatusChanged; btr.TransferProgressChanged += BtsProgressChanged; BackgroundTransferService.Add(btr); } void BtsProgressChanged(object sender, BackgroundTransferEventArgs e) { DrawProgressBar(e.Request.BytesReceived); }

56 Windows Phone Microsoft Corporation. Notifications  Time-based, on-phone notifications  Supports Alerts & Reminders  Persist across reboots  Adheres to user settings  Consistent with phone UX 56

57 Windows Phone Microsoft Corporation. Alarms vs Reminders? Alarms Modal Snooze and Dismiss Sound customization No app invocation No stacking Reminders Rich information Integrates with other reminders Snooze and Dismiss Launch app Follows the phones global settings 57

58 Windows Phone Microsoft Corporation. Code Sample: Alarms 58 Alarms using Microsoft.Phone.Scheduler; private void AddAlarm(object sender, RoutedEventArgs e) { Alarm alarm = new Alarm("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); }

59 Windows Phone Microsoft Corporation. Code Sample: Reminders 59 using Microsoft.Phone.Scheduler; private void AddReminder(object sender, RoutedEventArgs e) { Reminder reminder = new Reminder("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 = new Uri("/Reminder.xaml", UriKind.Relative); ScheduledActionService.Add(reminder); } Reminders

60 Devices and Sensors

61 Windows Phone Microsoft Corporation. Camera  Access to live camera stream  PhotoCamera  Silverlight 4 Webcam  Display in your app  Video Brush 61

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

63 Windows Phone Microsoft Corporation. Accelerometer  Measures force applied on each axis over time  Determine in which direction the user is moving the device  Expressed as a 3-dimensional vector 63 +Y -Y +X -X +Z -Z

64 Windows Phone Microsoft Corporation.  Measures rotational velocity on 3 axis  Significant drift  Indicates rotation even when device is stationary  Availability:  Optional on Mango phones  Not present in pre-Mango WP7 phones 64 Gyroscope

65 Windows Phone Microsoft Corporation. Code Sample: Gyroscope 65

66 Windows Phone Microsoft Corporation.  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 66 Compass (aka Magnetometer)

67 Windows Phone Microsoft Corporation.  Accelerometer required on all devices  Gyro and Compass sensors are optional Application should leverage sensors based on device capabilities 67 Sensor Hardware Availability

68 Windows Phone Microsoft Corporation.  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 68 Motion Sensor Always prefer Motion Sensor when available

69 Windows Phone Microsoft Corporation.  Degraded modes have lower quality approximations  When Motion.IsSupported is false, apps should use accelerometer or other input and control mechanisms 69 Motion Sensor Adapts to Devices AccelerometerCompassGyroMotion Yes Full Yes NoDegraded YesNoYesUnsupported YesNo Unsupported

70 Windows Phone Microsoft Corporation. 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 70

71 Communication

72 Windows Phone Microsoft Corporation. Push Notifications 72

73 Windows Phone Microsoft Corporation. Types of Push Notifications  Tile notifications  Update tile count, title and background image  Update back tile title, content and image  Toast/Deep Toast notifications  Display a on-top-like message  Take users directly to an application experience  Uses standard SL navigation (OnNavigatedTo)  Raw notifications  Can be used in application logic 73

74 Windows Phone Microsoft Corporation. Push Notifications (Core) Enhancements Reliability New TDET mechanism for broader network compatibility Lowered polling interval for non- persistent connection friendly networks Efficiency TLS resume for sessions within 8 hours Hints for improved radio dormancy Concurrent tile downloads for less radio uptime Performance Faster state machine for faster client service Smarter queue logic for less redundancy 74

75 Windows Phone Microsoft Corporation. Location and Services  The service obtains location data from multiple sources such as GPS, Wi-Fi, and cellular  Applications can access location information  Allows you to create location- aware applications 75

76 Windows Phone Microsoft Corporation. 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 76

77 Windows Phone Microsoft Corporation. Sockets Classes in Mango AreaSilverlight 4.0Windows Phone TCP SocketsSocket class (Async)Socket UDP SocketsUdpAnySourceMulticastClient UdpSingleSourceMulticastClient Socket AddressingSocketAddress IPAddress IPEndPoint SocketAddress IPAddress IPEndPoint Name Resolution DnsEndPoint NameResolution APIs

78 Windows Phone Microsoft Corporation. Code Sample: TCP Socket 78 _endPoint = new DnsEndPoint(“202.210.2.115", 5000); _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); SocketAsyncEventArgs args = new SocketAsyncEventArgs(); args.UserToken = _socket; args.RemoteEndPoint = _endPoint; args.Completed += new EventHandler (OnSocketConnectCompleted); _socket.ConnectAsync(args);

79 Windows Phone Microsoft Corporation. Code Sample: UDP Socket 79 Client = new UdpAnySourceMulticastClient(address, port); Client.BeginJoinGroup( result => { Client.EndJoinGroup(result); Dispatcher.BeginInvoke( delegate { OnAfterOpen(); Receive(); }); }, null);

80 Deployment and Marketplace

81 Windows Phone Microsoft Corporation. 81

82 Windows Phone Microsoft Corporation. Register Your Device 82  Test on a physical device  Register your device  Install, run, and debug unsigned applications  Use Zune to register your device

83 Windows Phone Microsoft Corporation. Deployment Process 83 Develop & Debug Submit & Validate Certify & Sign Windows Phone Application Deployment Service Marketplace

84 Windows Phone Microsoft Corporation. Marketplace Test Kit 84

85 Questions? 85


Download ppt "Windows Phone Development Tomer Shamam Senior Architect Sela Group."

Similar presentations


Ads by Google