This tutorial shows you how to add a cloud-based backend service to a Universal Windows Platform (UWP) app. For more information, see What are Mobile Apps. The following are screen captures from the completed app:
Running on a desktop.
Running on a phone
Completing this tutorial is a prerequisite for all other Mobile App tutorials for UWP apps.
To complete this tutorial, you need the following:
- An active Azure account. If you don't have an account, you can sign up for an Azure trial and get up to 10 free mobile apps that you can keep using even after your trial ends. For details, see Azure Free Trial.
- Visual Studio Community 2015 or a later version.
Create a new Azure Mobile App backend
Follow these steps to create a new Mobile App backend.
Sign in to the Azure portal.
In the search box, type Mobile Apps.
In the results list, select Mobile Apps Quickstart, and then select Create.
Under Resource Group, select an existing resource group or create a new one (using the same name as your app).
Click Create. Wait a few minutes for the service to be deployed successfully before proceeding.
You have now provisioned an Azure Mobile App backend that can be used by your mobile client applications. Next, you will download a server project for a simple "todo list" backend and publish it to Azure.
Configure the server project
Click the App Services button, select your Mobile Apps back end, select Quickstart, and then select your client platform (iOS, Android, Xamarin, Cordova).
If a database connection is not configured, create one by doing the following:
a. Create a new SQL database and server.
b. Wait until the data connection is successfully created.
c. Data connection must be successful.
Under 2. Create a table API, select Node.js for Backend language.
Accept the acknowledgment, and then select Create TodoItem table.
This action creates a new to-do item table in your database.
Switching an existing back end to Node.js overwrites all contents. To create a .NET back end instead, see Work with the .NET back-end server SDK for Mobile Apps.
Download and run the client project
Once you have configured your Mobile App backend, you can either create a new client app or modify an existing app to connect to Azure. In this section, you download a UWP app template project that is customized to connect to your Mobile App backend.
Back in the Quick start blade for your Mobile App backend, click Create a new app > Download, then extract the compressed project files to your local computer.
- (Optional) Add the UWP app project to the same solution as the server project. This makes it easier to debug and test both the app and the backend in the same Visual Studio solution, if you choose to do so. To add a UWP app project to the solution, you must be using Visual Studio 2015 or a later version.
- With the UWP app as the startup project, press the F5 key to deploy and run the app.
In the app, type meaningful text, such as Complete the tutorial, in the Insert a TodoItem text box, and then click Save.
This sends a POST request to the new mobile app backend that's hosted in Azure.
(Optional) Stop the app and restart it on a different device or mobile emulator.
Notice that data saved from the previous step is loaded from Azure after the UWP app starts.
- Add authentication to your app
Learn how to authenticate users of your app with an identity provider.
- Add push notifications to your app
Learn how to add push notifications support to your app and configure your Mobile App backend to use Azure Notification Hubs to send push notifications.
- Enable offline sync for your app
Learn how to add offline support your app using an Mobile App backend. Offline sync allows end-users to interact with a mobile app—viewing, adding, or modifying data—even when there is no network connection.