Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven
-
Upload
rick-g-garibay -
Category
Software
-
view
1.742 -
download
0
description
Transcript of Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven
![Page 1: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/1.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/2.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/3.jpg)
Developing
Mobile Apps
![Page 4: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/4.jpg)
Silo Approach:
Build
Apps Multiple
Times
![Page 5: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/5.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/6.jpg)
Most Popular Languages
![Page 7: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/7.jpg)
Xamarin Overview
![Page 8: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/8.jpg)
XamarinApproach
Native with
Code
Sharing
![Page 9: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/9.jpg)
Windows APIs
![Page 10: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/10.jpg)
iOSAPIs
100% coverage
![Page 11: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/11.jpg)
AndroidAPIs
100% coverage
![Page 12: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/12.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/13.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/14.jpg)
Portable Class Libraries
File/New/Portable Class Library
![Page 15: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/15.jpg)
Meet Tasky
![Page 16: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/16.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/17.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/18.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/19.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/20.jpg)
Azure Mobile Services
![Page 21: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/21.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/22.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/23.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/24.jpg)
DEMO 2
Creating an Azure Mobile Service
![Page 25: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/25.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/26.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/27.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/28.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/29.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/30.jpg)
User Auth Flow (server)
30
MOBILE SERVICE
DEVICE
MICROSOFT
ACCOUNT
MICROSOFT
ACCOUNT
AAD
![Page 31: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/31.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/32.jpg)
DEMO 4
Adding Authentication with Azure Mobile Services
![Page 33: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/33.jpg)
Code Reuse
![Page 34: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/34.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/35.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/36.jpg)
DEMO 5
Refactoring Tasky for Maximum Reuse
![Page 37: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/37.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/38.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/39.jpg)
Introducing
Xamarin.Forms
New in Xamarin 3.0
![Page 40: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/40.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/41.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/42.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/43.jpg)
Pages
Content MasterDetail Navigation Tabbed Carousel
![Page 44: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/44.jpg)
Layouts
Stack Absolute Relative Grid ContentView ScrollView Frame
![Page 45: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/45.jpg)
Login ViewModel
![Page 46: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/46.jpg)
Login Page – Code Behind
![Page 47: Visual Studio 2013, Xamarin and Microsoft Azure Mobile Services: A Match Made in Heaven](https://reader035.fdocuments.us/reader035/viewer/2022081404/5599e7ad1a28ab3f7a8b4824/html5/thumbnails/47.jpg)
Login Page – XAML