Developing i phone, android and windows phone 7 applications with c#
-
Upload
marcel-de-vries -
Category
Technology
-
view
401 -
download
3
description
Transcript of Developing i phone, android and windows phone 7 applications with c#
![Page 1: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/1.jpg)
![Page 2: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/2.jpg)
Developing iPhone, Android and Windows Phone 7 applications with C#
Roy CornelissenIT Architect,Info Support
Willem MeintsDeveloper,Info Support
Roy CornelissenIT ArchitectInfo Support
Willem MeintsDeveloperInfo Support
Marcel de VriesTechnology ManagerInfo Support
![Page 3: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/3.jpg)
Patterns ProofAgenda
Myths ALM
![Page 4: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/4.jpg)
Setting the context
Windows PhoneVisual Studio, XAML and C#
iOSMonoDevelop, MonoTouch and C#
AndroidVisual Studio, Mono for Android and C#C#
![Page 5: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/5.jpg)
Myth Busters
Common misconceptions
![Page 6: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/6.jpg)
Myth: Apps built with C# are not native
![Page 7: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/7.jpg)
C / C++Different CPU architectures
What is the meaning of “native”?• Different interpretations of “native”
Java
Objective-CC / C++
C# / Silverlight 3+
![Page 8: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/8.jpg)
What is the meaning of “native”?
• Native = use the frameworks and libraries of the OS, regardless of the language or tools• Native = User experience 100% aligned with default OS device experience
![Page 9: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/9.jpg)
DemoKnowledge Events app
![Page 10: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/10.jpg)
3 native flavors
App Logic
Vendor tools “Magic Box” Hybrid
XCodeObjective-
C
WP7 Silverligh
tC#
Android SDKJava
Appcelerator Titanium
JavaScript > Native
PhoneGapHTML5 / CSS /
JS
Adobe AIRActionScript
AntennaRapid
Scripting Language
Service2Media
Lua
C#
Xamarin
MonoTouch
WP7 Silverlig
ht XamarinMono for Android
RhodesRuby + HTML
Sybase Unwired
“4GL” code gen Shared
language
![Page 11: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/11.jpg)
Myth: Applications written with Mono are slow
![Page 12: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/12.jpg)
Demo: Mandelbrot comparison
Text/Icon/PicMonoTouch
Objective-CText/Icon/Pic
Benoit Mandelbrot
![Page 13: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/13.jpg)
Comparison Mono & Objective-C / Java
Speed upyour app
Develop wisely!
1.0
1.0
Application startup
Compute intensive
Service calls
UI interaction
![Page 14: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/14.jpg)
Perceived performanceYes there is overheadNative-to-Managed causes overheadMono has a garbage collectorCPU-intensive: use LLVM compiler
But it’s no problemMost of us don’t build real time 3D gfx
Make the app feel fastKeep download size smallCut startup time by offloading tasks ASAPUse background tasks & activity indicators
…is in the eye of the beholder
Performance…
![Page 15: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/15.jpg)
Even game developers choose Mono!
Delta engine
![Page 16: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/16.jpg)
Myth: Mono cannot access all device capabilities
![Page 17: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/17.jpg)
You can access all device capabilities!• For each platform there is a set of namespaces that
enable full device accessiOS
MonoTouch.CoreLocationMonoTouch.CoreMotionMonoTouch.AVFoundationMonoTouch.AddressBookMonoTouch.EventKit…
Android: Android.Hardware.SensorAndroid.LocationAndroid.BluetoothAndroid.Nfc…
Windows Phone: Microsoft.Devices.Sensors.GyroscopeMicrosoft.Devices.Sensors.AccelerometerMicrosoft.Devices.Sensors.CompassMicrosoft.Devices.Sensors.Motion…
Use device abstractions!
![Page 18: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/18.jpg)
Myth: Code Sharing percentage between apps is very low because of the different implementations per device
![Page 19: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/19.jpg)
Code Sharing
Reusable20%
Shared app logic20%Windows8
13%
iOS18%
WP712%
Android16%
Shared
65%
Specific35%
Per App
![Page 20: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/20.jpg)
As long as you do proper design
![Page 21: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/21.jpg)
Myth: You do not have to know the different devices to build apps for all different platforms
Roy Cornelissen
Willem Meints
Marcel de Vries
![Page 22: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/22.jpg)
Application Lifecycle Management
Managing cross platform development
![Page 23: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/23.jpg)
Cross device solution setup
Same directory structure used by all solutions
• Shared implementation project
• Include files your project needs
• Exclude files that are device specific
![Page 24: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/24.jpg)
Cross platform version control• Use TFS in the cloud• Use Local Workspaces• SVN model of Edit, Merge, check-in• No need to check out before edit
• Use Team Explorer Everywhere for Mac OS
• Added bonus: full support for Work Items, Build, etc.
![Page 25: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/25.jpg)
Architecture & Design Patterns
How to maximize reuse between platforms
![Page 26: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/26.jpg)
Define architecture for reuse
![Page 27: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/27.jpg)
Define architecture for reuse
Services
Model
ControllerViewModel
Etc.
GPS
Storage
Motion sensors
View
Shared?
BridgeShared Platform specific
![Page 28: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/28.jpg)
Services• What technology do you use to access data?• Should we use REST/WebApi?• Lot of hand coding since there is no standard way to generate
proxies• Should we do SOAP?• Good option, also provides out of the box support in the tools for
proxy generation• Proxy generation with SL tools, so we have full shared code base
cross stacks
• Use RIA services as back-end• Adds productivity for back-end and flexibility in endpoints• SOAP, JSON, OData
![Page 29: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/29.jpg)
Callback pattern
Shared Controller
UIViewController
XAML View Activity
Web Services
SF
SF
SF
Model
GetActualEvents (Action<object> OnSuccess,
Action<Exception> OnFail)
PropertyChanged(“Events”);
public void OnFailed(Exception e){ // Do something with error}
public void OnSuccess(object data){ // Do something with data // Notify user}
![Page 30: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/30.jpg)
Device Abstraction Patterns
![Page 31: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/31.jpg)
The proof of the pudding is in the eating…
![Page 32: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/32.jpg)
DemoBuilding an Event app
![Page 33: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/33.jpg)
Lessons learned• Android == Wild Wild West of mobile• Test ALWAYS on MULTIPLE devices!• Mono Release cycle only small lag with
vendor tools• UX design essential for apps• Good design up front of the app essential for
code sharing• First attempt 10% code share • Now we achieve 70-80% code sharing!
![Page 34: Developing i phone, android and windows phone 7 applications with c#](https://reader038.fdocuments.us/reader038/viewer/2022110307/5560b45ed8b42aef3b8b488d/html5/thumbnails/34.jpg)
© 2012 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.
Roy Cornelissen@roycornelissen
Willem Meints@wmeints
Marcel de Vries@marcelv