Cross Platform Mobile Development with Xamarin
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,513
On Slideshare
2,513
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
57
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Fast Enough for Games Native UX means that apps look like they belong Full platform SDK Access means that anything you can do in Obj-C on iOS or Java in Android, you can do here. Animation libraries, Media libraries, etc.
  • Need better graphic for this.
  • Need Visual Studio Screenshot
  • A good layered architecture allows for proper separation of responsibility and encapsulation, providing isolation to allow for code changes and maximizing code sharing between platforms. It also provides a pattern-agnostic framework so you can pick and choose which patterns you want to use, and then be flexible to changing them later on. And this is very simple to do. We’ll see later on how to accomplish this with proper namespacing and project setup.
  • Xamarin supports portable library projects, but they pose practical problems in real-world scenarios because of dependencies. it eliminates the ability to use ifDefs, so you have to do massive architectural refactoring, use the provider/simple dependency pattern, etc. to solve even minor things. Best way, instead is to link your code.
  • Don’t use .Android - the namespace will cause you hell
  • You can use SQLite on all three mobile platforms, iOS, Android, and WP7. on iOS and Android, SQLite is bundled with it, and on Windows Phone, you can use the open source C# port. We’ll show later how to easily support this cross platform with the same exact API. Additionally, we recommend SQLite.NET ORM for easy data access. For Data Access, we’ve added some nice convenience methods in TaskDatabase.cs that make the basic CRUD operations a snap with zero code.
  • Platforms are different. pInvoke is available on iOS and Android, not on WP. SQLite is native on Android and iOS, on WP you have to use the C# lib. Devices also have different features. Cameras are different on nearly every single android device out there. Some devices have location features, some don’t. Some vary, etc.
  • There are predefined symbols that allow you to use different code, depending on the platform you’re building for. Additionally, you can define your own symbols in Build Settings. Demo of this in use can be found here: TaskyPro :: CoreLib.DataLayer/SQLite.cs
  • ITask - Interface TaskBase - Task class DialogTask - with MT.D annotations

Transcript

  • 1. Xamarin Mobile Cross Platform Development
  • 2. bryan costanich em: bryanc@xamarin.com tw: @bryancostanich slides: slideshare.net/bryancostanich
  • 3. Sample Code github.com/xamarin/mobile-samples/TaskyPro blog.xamarin.com
  • 4. Xamarin Platform (The Pitch)
  • 5. One Language + Framework LINQ Lambdas Task Parallel Library (TPL) Compile-Time Checks Garbage Collection C# º
  • 6. Native Perf. + UX Compiles Down to Native Code Not Interpreted All Native UX Controls Full Platform SDK Access iOS: Selectors/Obj-C Runtime Android: JNI Fast Enough for Games º
  • 7. Reuse Story C# Libraries Obj-C Bindings + Binding Projects .jar Bindings + Binding Projects C via pInvoke C++ via Cxxi º
  • 8. Other Platforms Windows - via .NET Mac - via Xamarin.Mac Linux - via Mono Ouya, XBOX, PSP, etc. Etc.
  • 9. Community + Support Huge C# Community StackOverflow.com forums.xamarin.com IRC + chat.xamarin.com Great Support º
  • 10. VS + Xamarin Studio Visual Studio Xamarin Studio Android Designer iOS Designer (Beta) Debugging AutoComplete Refactoring Project Management Integrated Source Control
  • 11. General XPlat Considerations
  • 12. Design Platform-Specific UX UX in iOS != Android != Windows Phone UX Metaphors are Different: Navigation Controller vs. Back Button Write-Once, Run-Anywhere is Problematic Users Expect Native UX º
  • 13. Choose Device Targets iPhone != iPad Beware Android Fragmentation Form Factor + Capability Differences Inform UX Pro-Tip: Minimize Targets º
  • 14. Building an X-Plat Architecture
  • 15. Architecture Layers Separation of Responsibility Encapsulation Core Code Sharing º
  • 16. VS Project/Solution Setup
  • 17. Code Sharing - Linking vs. PCL Portal Library Projects - Take a Lot of Work Great Discussion Here: http://forums.xamarin.com/discussion/28/challenges-thoughts-loves/p1 Takeaway: PCL is clean, but difficult to implement Linking is less “clean” but simpler Our Recommendation Now: File Linking for Most Projects Walkthrough Here: Linking º
  • 18. WP7 + Android New Blank Solution: "[AppName]" New C# Lib Project: "[AppName].Core" Test Project: “[AppName].Core.Tests” New Mono for Android Project: “[AppName].Droid” New WP7 Project "[AppName].WP7" º
  • 19. Shared Data + Data Access Layer Data Access Layer SQLite on iOS + Android, C# SQLIte on WP7: http://code.google.com/p/csharp-sqlite/ SQLite.NET ORM Use Generics for CRUD Convenience Methods: TaskDatabase.cs º
  • 20. Platform Abstractions Handling Divergence and Taking Advantage of Platform Features
  • 21. Conditional Compilation Pre-Defined Symbols: #if __MOBILE__ #if __ANDROID__ #if __IOS__ #if WINDOWS_PHONE #if SILVERLIGHT Can Add Additional in Build Settings
  • 22. Architectural Abstraction Sometimes, You Wanna Provide Different Implementations for Different Platforms Interfaces º
  • 23. Component Store Tons of Components Cross-Platform IDE-Integration - drop-in! Revenue Model for User Submitted
  • 24. Xamarin.* Libraries XPlat API Abstractions Open Source Github.com/Xamarin/Xamarin.* Mobile Social Auth
  • 25. Other XPlat Libs MonoCross - http://code.google.com/p/monocross/ MvvmCross - https://github.com/slodge/MvvmCross Vernacular - https://github.com/rdio/vernacular MonoGame - http://monogame.net Cocos2D - http://cocos2DXNA.net º
  • 26. Q+A