basics of cross platform mobile development with xamarin

16
Cross Platform Mobile Development Igor Gorelik Readify

Upload: igor-gorelik

Post on 15-Jul-2015

62 views

Category:

Technology


2 download

TRANSCRIPT

Cross Platform Mobile Development

Igor Gorelik

Readify

Mobile – why bother?

For some sites about 50% of web traffic was generated from mobile devices

Mobile web vs native app

Mobile web

Pros

• Easy to create (HTML5 + JS)

• Cross platform – well... Almost…

• Full control over releases

Cons• Limited access to device capabilities• No control over target devices• User retention is a problem

Native app

Pros

• Full access to device capabilities

• Control over OS versions

• Stored on user’s device

Cons• 3+ platforms to support • App store has full control over releases

Mobile App – how? Native

Mobile App – how? HybridNative Shell

Browser UI control

Mobile App – how? Native HTML

Native part

HTML5 +JSPackaged as part of the

Application package

Native Application

Mobile App – how?

Xamarin.Android uses JIT compilation to execute code at runtime

Xamarin.iOS uses "Ahead-of Time" (AOT) compilation to create ARMxbinary

Xamarin – Android Runtime Model

Dalvik /

ART

VM

Mono VM

.APK

Android OS

Google Play, Support Lib, etc.

• Mono VM + Java VM execute side-by-side (supports both Dalvikand ART)

• Mono VM JITs IL into native code and executes most of .Net code

• Can utilize native libraries directly as well as .NET BCL

Xamarin – iOS Runtime Model

• Native ARMvX code – no JIT used

• Mono Runtime provides system services such as Garbage Collection

• Full access to iOS Frameworks such as MapKit as well as .NET BCL

Mono Runtime

.NET BCL

Cocoa Touch, MapKit , …

iOS

App Code

(ARMx )

Traditional/Native Xamarin approach

Application Logic (C#)

Android iOS Windows

Portable Class

LibraryShared Project

AND

/ OR

~75% to 80% shared code on average

Xamarin.Forms approach

~85% to 95% shared code on average

Summary

• Native approach• Easy access to platform specific UI/functionality

• UI layer is not reused across platform

• Good knowledge about how the native platform is essential

• Forms• Code reuse (including UI)

• Large number of features doesn’t require deep knowledge of native platform

So, you ask, what do I use for my next mobile app?