Create a Xamarin.Android App
This tutorial shows you how to add a cloud-based backend service to a Xamarin.Android app. For more information, see What are Mobile Apps.
A screenshot from the completed app is below:
Completing this tutorial is a prerequisite for all other Mobile Apps tutorials for Xamarin.Android apps.
To complete this tutorial, you need the following prerequisites:
- An active Azure account. If you don't have an account, sign up for an Azure trial and get up to 10 free Mobile Apps. For details, see Azure Free Trial.
- Visual Studio with Xamarin. See Setup and install for Visual Studio and Xamarin for instructions.
Create an Azure Mobile App backend
Follow these steps to create a Mobile App backend.
Sign in to the Azure portal.
Click Create a resource.
In the search box, type Mobile Apps.
In the results list, select Mobile Apps Quickstart, and then select Create.
Choose a unique App name. This will also be part of the domain name for your App Service.
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. Watch the Notifications (bell) icon in the portal header for status updates.
You have now provisioned an Azure Mobile App backend that can be used by your mobile client applications. Next, 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 Xamarin.Android app
Under Download and run your Xamarin.Android project, click the Download button.
Save the compressed project file to your local computer, and make a note of where you save it.
- Press the F5 key to build the project and start the app.
In the app, type meaningful text, such as Complete the tutorial and then click the Add button.
Data from the request is inserted into the TodoItem table. Items stored in the table are returned by the mobile app backend, and the data appears in the list.
You can review the code that accesses your mobile app backend to query and insert data, which is found in the ToDoActivity.cs C# file.