Cross platform mobile development with xamarin and office 365

Preview:

Citation preview

Cross-Platform Mobile Development withXamarin and Office 365

+

Rob Ringham

Rob RinghamArchitect & Mobile Expert at Infusion

twitter.com/robringham

linkedin.com/in/robringham

github.com/rringham

medium.com/@robringham

rringham@infusion.comwww.infusion.com

Agenda• What is Xamarin?• Why use it?• Alternatives: traditional native development,

PhoneGap, Ionic, Appcelerator, Telerik, etc…• Xamarin / Office 365 Integration

• Demo• How to get started• Questions

What is Xamarin?• Xamarin Platform

• Xamarin.iOS, Xamarin.Android, Xamarin.Mac (& more)

• Xamarin Forms• Xamarin Services

• Xamarin Component Store• Xamarin Test Cloud• Xamarin Insights

Xamarin Platform• Cross-platform mobile development

• Code sharing across multiple mobile platforms(C#, F#)

• Native user interfaces• Native API access• Native performance

Xamarin Platform• Xamarin.iOS: app C# code ahead-of-time

(AOT) compiled to ARM assembly (including subset of .NET framework)

• Xamarin.Android: app C# compiled to IL, packaged with MonoVM + JIT’ed, running side-by-side with Java/Android runtime

• Windows Phone: app runs under standard .NET Framework

Development Environment

IDE Support

• Xamarin Studio on OS X (uses VS solution /project format)

• Visual Studio on WindowsApp Build & Packaging Process

• iOS: leverages Apple iOS tooling on OS X• Android: leverages Google Android tooling

on Windows / OS X*iOS Visual Studio support requires a paired OS X machine

Xamarin.iOS• Apple’s iOS frameworks available

through .NET / C#• Platform SDK access accomplished via

Xamarin iOS bindings• Xamarin iOS bindings can be used to wrap

Objective-C / Swift code

Xamarin.iOS• UI built same as in traditional iOS native

development: with storyboards, XIBs / NIBs, code

• Xamarin iOS Designer or Xcode Interface Builder

• Similar development workflow (to traditional iOS native development)• MVC• Auto Layout / Device Size Classes• Outlets / Actions

*Excluding Xamarin Forms

Xamarin.Android• Google’s Android frameworks available

through .NET / C#• Xamarin Java binding libraries can be created

to wrap Java libraries

Xamarin.Android• UI built same as in traditional Android native

development: Android Layout files, Resources• Xamarin Designer or Android Studio• Similar development workflow (to traditional

Android native development)

• Activities• Intents

*Excluding Xamarin Forms

Managed wrappers for native controls

Why use Xamarin?Foundation

• Single language (C# / F#) for cross-platform mobile development

• Mature technology foundation: .NET Framework (& Mono)

Acceleration

• Code sharing across mobile platforms

• Sharing UI logic across mobile platforms*

• NuGet / Xamarin Component Store

Quality

• Native performance, native user experience

• Unit testing shared code

• UI automation testing

*with Xamarin Forms

Code Sharing• Shared code contained within Portable Class

Libraries (PCLs)• PCLs support multiple .NET Framework

platforms• PCL projects target specific profiles that

support a known set of BCL classes/features

• Native app assemblies reference shared PCLs

Code Sharing

Alternatives to Xamarin

Mobile Platforms: Comparison

Xamarin Traditional Native React Native PhoneGap / Hybrid Titanium Kony / Telerik / etc.

Native apps / UI / performance Yes Yes Yes No No No

Languages C# / F# Swift, Objective-C,Java JavaScript JavaScript JavaScript JavaScript

Cross-platform Code Sharing Yes No Yes Yes Yes Yes

Active Developer Community* Yes Yes No Yes No No

Commercially Licensed Yes No No No Yes Yes

xamarin swift react-native cordova titanium kony

Tagged on StackOverflow 9,472 61,572 1,083 38,886 1,637 64

Xamarin: Downsides• License costs• Memory management can be challenging,

particularly on iOS• iOS: Profiling tooling limited compared to

traditional native development with Instruments• Select Instruments tools still work with

Xamarin.iOS apps, though

Xamarin: Upsides• Standardized language (C#) across multiple

platforms• .NET Framework• NuGet• Shared Code Unit Testing• Async / Await• Xamarin Studio refactoring tools (or VS, if you

prefer)

Xamarin + Office 365

Demo App: High Level Architecture

Windows Azure Active Directory

Office 365Business

Subscription

Office 365

Unified API

Xamarin FormsApp (Shared

Code)

iOS App

Android App

Authenticates against

REST requests

Manages permissions

Demo App: Quick Links

• Office 365 Portal: https://portal.office.com• Azure AD Graph API Explorer:

https://graphexplorer2.azurewebsites.net• Example Requests:

• https://graph.microsoft.com/beta/me/messages• https://graph.microsoft.com/beta/me/calendar/events

Xamarin Forms• Xamarin Forms

• Native UI, shared codebase (up to 90% shared)

• Ideal for data entry, LOB apps• Platform-specific custom rendering of

controls possible• Everything else besides choice UI

framework still works “the Xamarin Way” - native UI, full native API access, native performance, etc…

Xamarin Forms• UI with Xamarin Forms

• Code based, XAML based• Adapts to target platform and target device

(e.g. phone vs. tablet)• No Auto Layout!• Various app page structures & layouts to

work with

Xamarin Forms

Demo

Demo Code

Full demo app available on GitHub

• iOS + Android support• github.com/rringham/XamarinOffice365• BYOCID

• “Bring your own Client ID”

How to get startedwith Xamarin

Getting Started• 30 day free trial of Xamarin Business (link)• Xamarin Resources

• Getting Started (link)• Introduction to Xamarin Forms (link)

• Office 365• Unified API Preview (link)

Questions?

Recommended