connected & disconnected apps with azure mobile apps

Post on 22-Feb-2017

72 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

Connected & Disconnected Apps with Azure Mobile Apps

The best apps stand out

• 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

Always connected?

opensignal.com/coverage-maps

What about a backend?

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

• 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?

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

Let’s build a backend

Create a Mobile Service

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

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>();

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();}

Query local table

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

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

User authentication

Much More

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

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

File sync

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

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

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

connect• Select a backend that grows with you

Summary

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

top related