visual studio 2013, xamarin and microsoft azure mobile services: a match made in heaven

47
Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven Rick G. Garibay VP, Distinguished Engineer, Neudesic Level: Introductory

Upload: rick-g-garibay

Post on 06-Jul-2015

1.746 views

Category:

Software


0 download

DESCRIPTION

Learn how you can harness the power of Visual Studio 2013 with the flexibility of Xamarin and the power of Microsoft Azure Mobile Services. Secure, federated identity. A durable, reliable and scalable backend. Scalable messaging fabrics that unlock assets both in the cloud and behind the firewall. All of these are table stakes when delivering modern mobile enterprise applications. Whether you are building responsive web apps for devices or targeting iOS, Android, Windows Phone or Windows Store apps, as a mobile developer, you must focus on delivering a beautiful and functional user experience if you want your apps to be adopted. What if you could have all of this plus the power or Visual Studio 2013 and Windows Azure? Well, now you can! Instead of reinventing the wheel each and every time you need to target a new device platform, learn how Visual Studio 2013 and Xamarin allow you to target iOS, Android and Windows devices while promoting reuse of code assets across platforms. And when you're done with the front–end work and are ready to wire up your mobile app, come see how Microsoft Azure Mobile Services provides a simplified stack that tackles security, durability, reliability and modern messaging all with just a few lines of code. In this session, you'll learn how you can harness the power of Visual Studio 2013 with the flexibility of Xamarin and the power of Microsoft Azure Mobile Services to tackle all of your cross platform and back end chores quickly and easily so you can focus on what your users really care about.

TRANSCRIPT

Page 1: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Visual Studio 2013, Xamarin and

Microsoft Azure Mobile Services:

A Match Made in Heaven

Rick G. GaribayVP, Distinguished Engineer, Neudesic

Level: Introductory

Page 2: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

About Me

• VP, Distinguished Engineer leading the DPG group at Neudesic

• Working on IoT, Intelligent Transportation and Hospitality & Gaming

• Microsoft MVP, Microsoft Azure

• Co-Author, “Windows Server AppFabric Cookbook” by Packt Pub.

• Chairman, Co-Founder Phoenix Connected Systems User Group

(PCSUG.org)

• twitter: @rickggaribay

• blog: http://rickgaribay.net

• email: [email protected] | [email protected]

Page 3: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Developing

Mobile Apps

Page 4: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Silo Approach:

Build

Apps Multiple

Times

Page 5: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Write Once,

Run Anywhere

Approach

Lowest

Common

Denominator

App Generation

Page 6: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Most Popular Languages

Page 7: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Xamarin Overview

Page 8: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

XamarinApproach

Native with

Code

Sharing

Page 9: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Windows APIs

Page 10: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

iOSAPIs

100% coverage

Page 11: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

AndroidAPIs

100% coverage

Page 12: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

How Xamarin Works

C# + .NET Runtime

Native UI

Native Performance

Xamarin.iOS does full Ahead Of Time

(AOT) compilation to produce an ARM

binary for Apple’s App Store.

Xamarin.Android takes advantage of

Just In Time (JIT) compilation on the

Android device.

Page 13: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

IDE Options by Platform• Android

– Xamarin Studio

– Visual Studio

• iOS– Xamarin Studio

– Visual Studio

• Windows– Visual Studio

Visual Studio 2013 Support

– Xamarin.Android

– Xamarin.iOS

– Windows Phone

– Windows Store

– Universal Apps

Page 14: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Portable Class Libraries

File/New/Portable Class Library

Page 15: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Meet Tasky

Page 16: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Tasky Demo App

• Create a task

• List tasks

• Complete a task

• Delete a task

Page 17: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Tasky Architecture

Tasky.WindowsPhone Tasky.Android Tasky.iOS

Common

SQLite

Page 18: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

DEMO 1

Cross Platform Development with Xamarin & Visual Studio 2013

Page 19: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Tasky Opportunities

• Refactor code to use a single back end

• Move back end to cloud

• Add Authentication & Authorization

• Maximize code sharing and reuse

Page 20: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Azure Mobile Services

Page 21: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

What is Azure Mobile Services?Storage

Authentication

Logic

Push

Scheduler

Page 22: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Mobile Services Overview

Windows Store

iOS

Android

Xamarin

Sencha

Windows Phone

iOS

Android

HTML 5/JS

SDKs

Node.js Express

.NET Web API

RE

ST

AP

I

Facebook Twitter Microsoft GoogleActive

Directory

SQLTable

StorageBlob

Storage

WNS & MPNS APNS GCM

Mongo DB

Notification Hubs

Source Control

Page 23: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Azure Mobile Services• One backend for all your devices

– Client SDKs for Windows, Windows Phone, iOS, Android, Cordova, and Xamarin

– Backends can be either .NET or JavaScript

• Store data in the cloud– Using SQL or other backends like Azure Storage Tables and Mongo DB

• Authenticate users– FB, Twitter, Microsoft Account, Google, and AAD

• Push notifications– Built in support for cross-platform, low latency, and high volume push notifications with

notification hubs

Page 24: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

DEMO 2

Creating an Azure Mobile Service

Page 25: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Server Side Table Scripts

25

Node.js scripts

Intercept CRUD requests

to tables

Passes through to SQL by

default

Fully customizable

.NET Web API

Visual Studio

.NET Web API

backend in

Visual Studio

MongoDB, Table Storage,

SQL out of the box

Page 26: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Structured Storage

• Powered by SQL Database

• Supports rich querying capabilities

• Dynamic Schematization

• Data management in:– Azure Portal

– SQL Portal (Silverlight)

– SQL Management Studio

– REST API

– Azure CLI Tools

– SQL CLI

• Auto Generated Columns:

– id – unique guid

– __createdAt – date

– __updatedAt – date

– __version – timestamp

• Helps with concurrency and

offline

26

Page 27: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

The REST API

Action HTTP Method URL Suffix

Create POST /TodoItem

Read GET /TodoItem?filter=id%3D42

Update PATCH /TodoItem/id

Delete DELETE /TodoItem/id

Base Endpoint: https://MobileService.azure-mobile.net/tables/*

Page 28: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

DEMO 3

Storing and accessing data with Azure Mobile Services

Page 29: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Data Authorization

• Per HTTP method auth options:– App Key Required

• Not ideal for production use

– Everyone

– Authenticated Users

– Admins and other scripts• Requires Master Key as header

• 401 Unauthorized response if security check fails

29

Page 30: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

User Auth Flow (server)

30

GOOGLE

FACEBOOK

TWITTER

MOBILE SERVICE

DEVICE

MICROSOFT

ACCOUNT

MICROSOFT

ACCOUNT

AAD

Page 31: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

The User Object

User.level

– Admin

– Authenticated

– Anonymous

User.userId

– Provider:id or undefined

User.getIdentities()

– UserId

– Provider Access Token / Secret

– Basic user information (i.e. name, username, locale, picture, link)

31

Page 32: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

DEMO 4

Adding Authentication with Azure Mobile Services

Page 33: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Code Reuse

Page 34: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

UniversalApps

Universal Apps• Easily share code between platforms

Available in VS 2013• Just add Android and iOS

Coming soon to Xamarin Studio• For Mac users

Page 35: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Portable Class Libraries

Pure PCL• Limits expressiveness, but easy to build

• Requires interfaces/plugs to work properly

Advanced PCL:• Combined PCL with NuGet

• Public API remains “pure”

• Implementation is as native and direct as you desire

PCL + NuGet

Page 36: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

DEMO 5

Refactoring Tasky for Maximum Reuse

Page 37: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Resources

• Xamarin for Visual Studio

• TaskyPortable Sample on GitHub

• Xamarin + Azure Mobile Services

• Azure Mobile Services PCL State of the Art

Page 38: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

About Me

• VP, Distinguished Engineer leading the DPG group at Neudesic

• Working on IoT, Intelligent Transportation and Hospitality & Gaming

• Microsoft MVP, Microsoft Azure

• Co-Author, “Windows Server AppFabric Cookbook” by Packt Pub.

• Chairman, Co-Founder Phoenix Connected Systems User Group

(PCSUG.org)

• twitter: @rickggaribay

• blog: http://rickgaribay.net

• email: [email protected] | [email protected]

Page 39: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Introducing

Xamarin.Forms

New in Xamarin 3.0

Page 40: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Xamarin + Xamarin.FormsWith Xamarin.Forms:

more code-sharing, native controlsTraditional Xamarin approach

Shared UI Code

Page 41: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Xamarin + Xamarin.Forms

Shared UI Code

Quickly and easily build native user

interfaces using shared code

Xamarin.Forms elements map to native

controls and behaviors

Mix-and-match Xamarin.Forms with

native APIs

Page 42: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

What’s Included� 40+ Pages, Layouts, and Controls

� Build from code behind or XAML

� Two-way Data Binding

� Navigation

� Animation API

� Dependency Service

� Messaging Center

Page 43: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Pages

Content MasterDetail Navigation Tabbed Carousel

Page 44: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Layouts

Stack Absolute Relative Grid ContentView ScrollView Frame

Page 45: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Login ViewModel

Page 46: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Login Page – Code Behind

Page 47: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven

Login Page – XAML