xamarin cross platform

37
Guada Casuso [email protected] Modern Apps COE Architect Mobile Cross Platform Development using Xamarin

Upload: guada-casuso

Post on 07-May-2015

694 views

Category:

Technology


2 download

DESCRIPTION

This presentation walk trough Xamarin, MVVMCross and Cross Platform Mobile development

TRANSCRIPT

Page 1: Xamarin cross platform

Guada [email protected] Apps COE Architect

Mobile Cross Platform Development using Xamarin

Page 2: Xamarin cross platform

Topics we will cover:

Mobile Cross Platform Development Mobile Landscape: Web, Hybrid and Native  Cross-Platform Architectures

Xamarin Overview and Architecture MVVMCross General Android client and iOS client

Architectures

Page 3: Xamarin cross platform

CrossPlatform Mobile App Development

Page 4: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

• Performance • APIs Support• Tools• Monetization

CrossPlatform Mobile App DevelopmentQuality is Hard

Page 5: Xamarin cross platform

device

browser

app

Web App

device

Hybrid App

wrapper

app

wrapper API

Native App

device

app

Web App Hybrid App Native App

Use of device specific features and sensors

Portability across platforms

Performance & Native Experience

Updatability

5 OS Versions x 8 Manufacters x 20 Languages x 27

screen sizes3 OS Versions x 8

Devices x 20 Languages

2 OS Versions x 17 Devices x 20 Languages

Mobile Applications Development

Page 6: Xamarin cross platform

  Input Distribution Channels Output Key Players

Mobile Browser HTML, CSS, JavaScript

WWW Web Document Safari – Chrome – Mozila

Web Wrapper HTML, CSS, JavaScript

App Store Hybrid Package PhoneGap

Web-to-native converter

Javascript App Store Native Package Titanium

Native JavaScript API

HTML, CSS, JavaScript

App Store Native Package BB , w8

Native C# App Store Native Package Xamarin

CrossPlatform Mobile App Development

Implementation Approaches

Page 7: Xamarin cross platform

CrossPlatform Mobile App Development

Adoption Factors

Mobile Browser

Web Wrapper

Web-to-native converter

Native JavaScript API

Page 8: Xamarin cross platform

Web Mobile Apps

Top 5 supported featuresGeolocationAPI, offline web application support, WebStorage, CSS3 Selectors and 2D animations are the top five supported features.

A responsive web application developed using HTML5, CSS3, and JavaScript could be viewed on phone browser,To support a variety of device sizes while keeping a single code base, a website should use responsive web development technologies like CSS3 or frameworks like Bootstrap or Foundation.

Page 9: Xamarin cross platform

Hybrid Mobile AppsFor run-of-the-mill business applications, hybrid app provides necessary functionality and performance most of the time.

A hybrid mobile app is build using HTML5, CSS3, JavaScript, PhoneGap and it runs on iOS, Android, Windows Phone and Black Berry.Hybrid app is 'hybrid' because it uses HTML 5 & CSS3 for mobile UI and JavaScript to communicate with device SDK.

Hybrid app = Single Page ApplicationHybrid mobile app is basically a single page application (or SPA). SPA is a web application that lives within a single HTML page.

Page 10: Xamarin cross platform

NATIVE Apps Performance

APIs Support Tools Monetization

Page 11: Xamarin cross platform

Languages, Skills, Versions Maintenance – evolution&

Performance

Native Support, Leverage C# Skills, familiar IDE …

Page 12: Xamarin cross platform

Fully native apps written entirely in C#

Xamarin exposes 100% of iOS and Android APIs in C#

Mobilize existing code, skills, and tools including Visual Studio

Share app logic code across

device platforms

C# unique approachpowered by Xamarin and Microsoft .NET

C# + XIB C# + XML C# + XAML

Native UI Native UI Native UI

Optional Remote Services(ASP.NET Web API

or any server technology)

Shared client app C# logic

Page 13: Xamarin cross platform

What is Xamarin?Extension to Visual Studio• iOS, Android apps

entirely within Visual Studio

• Compiles .NET/C# code to native platforms

• Visual Studio ALM and IDE capabilities fully available

Build apps faster• Leverage skills• Reuse code and binaries

with flexibility• Fully native user

interfaces

Page 14: Xamarin cross platform

Microsoft and Xamarin Partner Globally

With Xamarin, developers combine all of the productivity benefits of C#, Visual

Studio 2013 and Windows Azure with the flexibility to quickly build for multiple

device targets.” S. Somasegar, Corporate Vice President,

Microsoft

Technical collaboration for superior developer

experience

Exclusive MSDN offers that accelerate the

transition to mobile development

Page 15: Xamarin cross platform
Page 16: Xamarin cross platform

Create UI with drag and drop simplicity

Target multiple screen sizes, resolutions, and OS versions

Layouts saved in native resource formats

Worlds best Android designer available in Visual Studio

iOS coming soon

UI design inVisual Studio

Page 17: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

Xamarin - Architecture

Xamarin.iOS does full Ahead Of Time (AOT) compilation to produce an ARM binary suitable for Apple’s App Store

Xamarin Android takes advantage of Just In Time (JIT) compilation on the Android device

Page 18: Xamarin cross platform

DEMO Xamarin integrated to

Visual Studio

Page 19: Xamarin cross platform

MVVMCross

Page 20: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

Separate Reusable Code into a Code library

Page 21: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

MVVMCross

Page 22: Xamarin cross platform

MVVMCross: What is?

MVVM Implementation for multiple platforms

Native, Cross-Platform, Portable, Reusable C#

Page 23: Xamarin cross platform

Code Evolution 1

• Single Mono for Android• Simple – it Works• Good separation of UI from “Model”

code

But• No testing• Portability by cut/paste

Page 24: Xamarin cross platform

Code Evolution 2

• PCL code• Data binding in UI• XML got bigger• Code overall increased in size

Page 25: Xamarin cross platform

Code Evolution 3

• Cross Platform• 100% shared application logic• 100% shared test harness

Page 26: Xamarin cross platform

General Android client and iOS client

Architectures

Page 27: Xamarin cross platform

Architecture of a Mobile App• Xamarin Mobile Apps

share the same architecture across all platforms

• Up to 95% shared code, depending on the Patterns you use

• UI is platform-specific, utilizes the Platform SDK projections

• App Code is in C#• Can reuse existing .NET

Library

UI

App code(C#)

Components

.NET Lib Code

Platform SDK Binding

Shared

Platform specific

Platform specific

Page 28: Xamarin cross platform

Platform Comparison

Package .app .apk .xap

Typeof(Screen) Controller Activity Page

Typeof(Control) View Widget Control

UI Files (xml) .xib .axml .xaml

Default UI Pattern MVC MVC MVVM

Page 29: Xamarin cross platform

Basic Android Architecture

Linux Kernel

Android Framework

Application

Dalvik VM

Activity

Service

Content ProviderBroadcas

t Receiver

Mono VMXamarin .apk

• Mono VM + Dalvik Run Side by Side using a bridge

• Mono VM is Faster than Dalvik

• Interop Directly with Android OS + Dalvik

Page 30: Xamarin cross platform

Basic iOS Architecture

iOS SDK

Mono

Xamarin.iOS

C# Code

MonoTouch.dll

Mono Compiler

Native ARM

Assembly

Page 31: Xamarin cross platform

Is not just a Mobile App, is a Modern App

Page 32: Xamarin cross platform

CrossPlatform Mobile App Development

Tools

Page 33: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

Xamarin

Page 34: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

Pair Xamarin.iOS build Host

Page 35: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

References

Mobile CrossPlatform Developer Economicshttp://www.visionmobile.com/blog/2014/02/developer-economics-q1-2014/

MVVMCrosshttp://www.slideshare.net/slideshow/embed_code/15621659 https://github.com/MvvmCross/MvvmCrosshttps://github.com/MvvmCross/MvvmCross/wiki/MvvmCross-Tutorialshttp://xamarin.com/evolve/2013#session-dnoeeoarfj

Xamarinhttp://xamarin.com/msdn-exclusive

Channel 9 Video Series: http://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Cross-Platform-Development-With-Xamarin

Page 36: Xamarin cross platform

MICROSOFT CONFIDENTIAL – INTERNAL ONLY

References

Mobile WorkForce Technical Overview: http://infopedia/docstore/pages/kcdoc.aspx?k=KC02-23-21345

Mobile Workforce Code and Scripts https://microsoft.sharepoint.com/teams/modernapps/Offerings/_layouts/15/start.aspx#/MobileWorkforce/Forms/AllItems.aspx?RootFolder=%2fteams%2fmodernapps%2fOfferings%2fMobileWorkforce%2fDemo&FolderCTID=0x012000390A00701058EB4EB572AC108FED089C

Page 37: Xamarin cross platform

© 2013 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.