Connected & Disconnected Apps with Azure Mobile Apps

  • Published on
    22-Feb-2017

  • View
    6

  • Download
    2

Transcript

PowerPoint Presentation

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

CrashesHard to navigate, poor UI, bad user experienceFeatures not as advertisedSlow or laggy experienceData 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 ScaleDatacenters recently added in Canada, China, and India

And you get all the goodness shown in the previous slides across the WWBuild 2015

2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.2/20/2017 3:50 PM9

Extremely powerfulFlexibleEasy Tables (Node.js Backend)App Service (ASP.NET Backend)Cross-platform client SDKiOS, Android, and WindowsOpen source C#Backend and Client SDKS on GitHubWhy Azure Mobile Apps?

Extremely powerfulYou can do almost anything your backend would ever need to do with Azure. Data storage, authentication/authorization, push notifications, custom APIs, blob storage, etc.FlexibleNeed something lightweight? Azure is there.Need something robust and powerful? Azure is there.C# clientsIm a frontend developer, I care a lot about how easy this makes MY job (selfish)Many C# clients are written by Java developers, etc.Easy to use C# clientAbstracts away much of pain of using a RESTful APIC# FeaturesAsync / Await / TPLUses C# idiomsProperties, Fluent APISeems obvious, but not always true (first class citizen)

10

REST API

Offline sync

Push Notifications

Data connections

User Authentication

FacebookTwitterMicrosoftGoogleAzure Active Directory

Azure Mobile Apps

Windows

AndroidChromeiOS OSX

In-App

Kindle

Xamarin, iOS, Android & Windows SDKsBackend code

SQL

MongoTables

O365

API Apps

Offline Sync

Lets build a backend

Create a Mobile ServiceMobileService = new MobileServiceClient("https://myapp.azurewebsites.net");

132/20/2017 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Create tablesIMobileServiceSyncTable syncTable;

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

}

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

142/20/2017 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Push and pull with sync tableprivateasyncTaskSyncAsync(){awaitMobileService.SyncContext.PushAsync();varquery=syncTable.CreateQuery(); awaitsyncTable.PullAsync("todoItems",query);}privateasyncTaskInsertTodoItem(TodoItemtodoItem){awaitsyncTable.InsertAsync(todoItem); awaitMobileService.SyncContext.PushAsync();}

152/20/2017 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Query local tablepublicasyncTaskGetOpenItemsAsync(){returnawaittodoTable.Where(item=>item.Complete==false).ToEnumerableAsync();}

162/20/2017 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Secure your app with prebuilt authentication providersFacebookTwitterGoogleMicrosoftAzure ADAnything OAuth 2User authentication

What if a GetAll should only return favorites for that user.17

Much More

Push notifications with Notification Hub

App Backend

Platform Notification Service

Notification HubMaps between tags and handles1. Get PNS handle4. Send to device2. Store PNS handle3b. Request notification Use device handles3a. Request notificationUse logical users/tags5. Manage device handles

Backend deletes expired handles when PNS rejects themMaintain mapping between logical users/groups and device handles

19

Sync files to Azure StorageOnline/Offline, just like table storageFile sync

20

Shopping Demo AppAvailable on

Azure Services:Cognitive Services (Emotion API)Storage On/offline syncPush notificationsAuthentication

Whats Available:Complete sample app with documentationIndividual quick starts

github.com/Microsoft/XamarinAzure_ShoppingDemoApp

2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.2/20/201721

Shared C# codebase 100% native API access High performance iOS C# UI Windows C# UIAndroid C# UIShared C# Mobile

C# Server

Linux/MonoCoreCLR

AzureShared C# Client/ServerMobile + Server

With Xamarin it just isnt your front end in C# it is your full backend server as well. With Azure or even on Linux running Mono or the CoreCLR your app is fully C# end to end!Build 2015 2015 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.2/20/2017 3:50 PM22

Plan for global reachAlways cache data locallyAssume success and push updates on re-connectSelect a backend that grows with youSummary

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

Get started today with free 30 day trial of Xamarin at xamarin.com24