connected & disconnected apps with azure mobile apps

24
Pranav Ainavolu @a_pranav | http://pranavon.net/ Microsoft MVP | Lead – Microsoft User Group Hyderabad (MUGH) Connected & Disconnected Apps with Azure Mobile Apps

Upload: pranav-ainavolu

Post on 22-Feb-2017

71 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Connected & Disconnected Apps with Azure Mobile Apps

Pranav Ainavolu@a_pranav | http://pranavon.net/ Microsoft MVP | Lead – Microsoft User Group Hyderabad (MUGH)

Connected & Disconnected Apps with Azure Mobile Apps

Page 2: Connected & Disconnected Apps with Azure Mobile Apps

The best apps stand out

Page 3: Connected & Disconnected Apps with Azure Mobile Apps

• Crashes• Hard to navigate, poor UI, bad user

experience• Features not as advertised• Slow or laggy experience• Data not available when you need it

Bad app experiences

Page 4: Connected & Disconnected Apps with Azure Mobile Apps

Always connected?

Page 5: Connected & Disconnected Apps with Azure Mobile Apps

opensignal.com/coverage-maps

Page 6: Connected & Disconnected Apps with Azure Mobile Apps
Page 7: Connected & Disconnected Apps with Azure Mobile Apps
Page 8: Connected & Disconnected Apps with Azure Mobile Apps

What about a backend?

Page 9: Connected & Disconnected Apps with Azure Mobile Apps

100+ datacentersTop 3 networks in the world2x AWS, 6x Google DC RegionsG Series – Largest VM in World32 cores, 448GB Ram, SSD…

Operational

Announced

* Operated by 21Vianet

24Azure compute regions open todayMore than AWS and Google Cloud combined

Infrastructure designed for Scale

Datacenters recently added in Canada, China, and India

Page 10: Connected & Disconnected Apps with Azure Mobile Apps

• Extremely powerful• Flexible• Easy Tables (Node.js Backend)• App Service (ASP.NET Backend)

• Cross-platform client SDK• iOS, Android, and Windows

• Open source C#• Backend and Client SDKS on GitHub

Why Azure Mobile Apps?

Page 11: Connected & Disconnected Apps with Azure Mobile Apps

REST

API

Offline sync Push Notifications

Data connections

User Authentication

Facebook

Twitter Microsoft Google

Azure Active

Directory

Azure Mobile Apps

WindowsAndroid

Chrome

iOS OSX

In-AppKindle

Xamarin, iOS, Android & Windows SDKs

Backend code

SQL MongoTables O365 API Apps

Offline Sync

Page 12: Connected & Disconnected Apps with Azure Mobile Apps

Let’s build a backend

Page 13: Connected & Disconnected Apps with Azure Mobile Apps

Create a Mobile Service

MobileService = new MobileServiceClient("https://myapp.azurewebsites.net");

Page 14: Connected & Disconnected Apps with Azure Mobile Apps

Create tablesIMobileServiceSyncTable<TodoItem> syncTable;

public async Task Init(){ const string path = "syncstore.db"; var db = new MobileServiceSQLiteStore(path); db.DefineTable<TodoItem>();

}

await MobileService.SyncContext.InitializeAsync(db); syncTable = MobileService.GetSyncTable<TodoItem>();

Page 15: Connected & Disconnected Apps with Azure Mobile Apps

Push and pull with sync tableprivate async Task SyncAsync(){    await MobileService.SyncContext.PushAsync();    var query = syncTable.CreateQuery();     await syncTable.PullAsync("todoItems", query);}

private async Task InsertTodoItem(TodoItem todoItem){    await syncTable.InsertAsync(todoItem);    await MobileService.SyncContext.PushAsync();}

Page 16: Connected & Disconnected Apps with Azure Mobile Apps

Query local table

public async Task<IEnumerable<TodoItem>> GetOpenItemsAsync(){    return await todoTable                 .Where(item => item.Complete == false)                 .ToEnumerableAsync();} 

Page 17: Connected & Disconnected Apps with Azure Mobile Apps

• Secure your app with prebuilt authentication providers• Facebook• Twitter• Google• Microsoft• Azure AD• Anything OAuth 2

User authentication

Page 18: Connected & Disconnected Apps with Azure Mobile Apps

Much More

Page 19: Connected & Disconnected Apps with Azure Mobile Apps

Push notifications with Notification Hub

App Backend

Platform Notification Service

Notification Hub• Maps between tags and handles

1. Get PNS handle

4. Send to device

2. Store PNS handle 3b. Request notification Use device handles

3a. Request notification

Use logical users/tags

5. Manage device handles

Page 20: Connected & Disconnected Apps with Azure Mobile Apps

• Sync files to Azure Storage• Online/Offline, just like table storage

File sync

Page 21: Connected & Disconnected Apps with Azure Mobile Apps

Shopping Demo App

Available on

Azure Services:• Cognitive Services (Emotion

API)• Storage • On/offline sync• Push notifications• AuthenticationWhat’s Available:• Complete sample app with

documentation• Individual “quick starts”

github.com/Microsoft/XamarinAzure_ShoppingDemoApp

Page 22: Connected & Disconnected Apps with Azure Mobile Apps

Shared C# codebase • 100% native API access • High performance

iOS C# UI

Windows C# UIAndroid C# UI

Shared C# Mobile

C# Server

Linux/MonoCoreCLRAzure

Shared C# Client/Server

Mobile + Server

Page 23: Connected & Disconnected Apps with Azure Mobile Apps

• Plan for global reach• Always cache data locally• Assume success and push updates on re-

connect• Select a backend that grows with you

Summary

Page 24: Connected & Disconnected Apps with Azure Mobile Apps

Get started todayxamarin.com/downloadxamarin.com/azurexamarin.com/dev-ops