Upload
pierce-boggan
View
252
Download
2
Embed Size (px)
Citation preview
Pierce Boggan@pierceboggan@bostonmobiledev
Powerful Backends with Microsoft Azure
Plenty of OptionsAmazon Web Services
Azure Mobile Apps
IBM MobileFirst
Oracle Mobile Cloud
SQLCIipher
Couchbase
MySQL
SQLite-net
soundcloud.com/xamarin-podcast
• Extremely powerful• Flexible• Easy Tables• App Service
• C# clients, written by C# developers
Why Azure?
REST
API
Offline sync Push Notifications
Data connections
User Authentication
Twitter Microsoft Google
Azure Active
Directory
Azure Mobile Apps
WindowsAndroid
Chrome
iOS OSX
In-AppKindle
Xamarin & Windows SDKs
Backend code
SQL MongoTables O365 API Apps
Offline Sync
Introducing Azure Mobile Apps
Xamarin Platform: native apps across platforms
Xamarin’s Unique Approach
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
Visual Studio Xamarin Studio
Build native UIs for iOS, Android, and Windows Phone from a single, shared C# codebase.
Meet Xamarin.Forms
Xamarin + Xamarin.Forms
Traditional Xamarin Approach
With Xamarin.Forms:More code-sharing, all
native
iOS C# UI Windows C#
UIAndroid C# UI
Shared C# Backend
Shared UI Code
Shared C# Backend
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
Shared C# Backend
Shared UI Code
<?xml version="1.0" encoding="UTF-8"?><TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.MainPage"><TabbedPage.Children><ContentPage Title="Profile" Icon="Profile.png"> <StackLayout Spacing="20" Padding="20" VerticalOptions="Center"> <Entry Placeholder="Username" Text="{Binding Username}"/> <Entry Placeholder="Password" Text="{Binding Password}" IsPassword="true"/> <Button Text="Login" TextColor="White" BackgroundColor="#77D065" Command="{Binding LoginCommand}"/> </StackLayout></ContentPage><ContentPage Title="Settings" Icon="Settings.png"> <!-- Settings --></ContentPage></TabbedPage.Children>
Native UI from shared code
Windows Xamarin.FormsStackPanel StackLayoutTextBox EntryListBox ListViewCheckBox SwitchProgressBar ActivityIndicatorGrid GridLabel LabelButton ButtonImage ImageDate/TimePicker Date/TimePicker
Control Comparison
Windows Xamarin.FormsDataContext BindingContext{Binding Property}
{Binding Property}
ItemsSource ItemsSourceItemTemplate ItemTemplateDataTemplate DataTemplate
BindingComparison
Azure Easy Tables
Azure is super powerful. But what if you just need a simple data store?
• Add a backend to your mobile app in as little as 15 minutes!
• Great for simple data storage / authentication / push capabilities
• Just like “old Azure Mobile Services” / Parse• Features• No-code CRUD backend• Create schema yourself• View app data
Azure Easy Tables
• Very limited control over how your backend operates – how data is stored, etc.
• End up having to move more logic to frontend than is ideal.
• Examples• GetAll should only return items for a particular user – very difficult to
do.• Trigger a push notification when an item is added to the a table
Azure Easy Tables - Tradeoffs
• Improve app responsiveness by caching server data locally on the device
• Make apps resilient against intermittent network connectivity.
• Allow end-users to create and modify data even when there is no network access, supporting scenarios with little or no connectivity.
• Sync data across multiple devices and detect conflicts when the same record is modified by two devices.
Offline Sync
Create a MobileServiceMobileService = new MobileServiceClient(
"https://myapp.azurewebsites.net);
Create TablesIMobileServiceSyncTable<Todo> table;public async Task Init(){ const string path = "syncstore.db"; var db = new MobileServiceSQLiteStore(path); db.DefineTable<Todo>();
}
var handler = new MobileServiceSyncHandler(); await MobileService.SyncContext.InitializeAsync(db, h); table = MobileService.GetSyncTable<Todo>();
Get and Modify Datapublic async Task<IEnumerable<Store>> GetStoresAsync(){ await table.PullAsync("allStores", table.CreateQuery()); return await table.ToEnumerableAsync();}public async Task<Store> AddStoreAsync (Store store){ await table.InsertAsync (store); await table.PullAsync("allStores", table.CreateQuery()); await MobileService.SyncContext.PushAsync(); return store;}
Let’s build an app!
• “App Service is a cloud platform to build powerful web and mobile apps that connect to data anywhere, in the cloud or on-premises”
• Easy Tables with more control.• Migrate from Easy Tables to App Service without any frontend changes.
• Stack: ASP.NET Web API + OData + Entity Framework
Azure App Service
• Full control over how your data is stored and retrieved
• Built-in autoscale, load balancing, and performance monitoring
• Add continuous running logic with WebJobs• Connect your mobile app to SaaS APIs, like
Office 365, SharePoint, and SAP• Access on-prem data with hybrid
connections with a VPN
Why Azure App Service?
• Rolling your own account infrastructure is difficult and time-consuming
• Secure your app with prebuilt authentication providers• Facebook• Twitter• Google• Microsoft• Azure AD• Anything OAuth 2
Authentication
• Easy-to-use, multiplatform scaled push infrastructure that allows you to send push notifications almost anywhere.
Push Notifications
• Sync files to Azure Storage, just like you did for structured data.
File Sync
Connect with your Consumers• Consumer Application• Browse Stores & Details• Call & Navigate to Store• Easily Send Feedback
• Rich Native Interface• 100% Shared C# Code
My Shoppe
Product catalog for field sales teams• 96% code reuse using
Xamarin.Forms• Data storage with Azure• Authentication with ADAL• Charting with SyncFusion
AppCRM
Consumer app built with Xamarin.Forms
• 93% code reuse• Azure backend• Templated push notifications• Authentication with Google OAuth
Sport
Get Started Todayxamarin.com
Free 30 Day Trial - xamarin.com/university
Unrivaled Mobile
Development Training
Live unlimited mobile development training from mobile experts, in your time-zone, on your schedule, and as often as you'd like.
evolve.xamarin.-com
• Azure• Blog: azure.microsoft.com/en-us/blog/• Twitter: twitter.com/azuremobile• Documentation:
azure.microsoft.com/en-us/documentation/services/app-service/• Xamarin• Blog: blog.xamarin.com• Twitter: twitter.com/xamarinhq• Documentation:
developer.xamarin.com/guides/cross-platform/azure/mobile-services/
Resources
Thank You! Questions?Pierce BogganSoftware Engineer, Evangelism Team, Xamarin
@pierceboggan @bostonmobiledev
github.com/pierceboggan