title | description | services | documentationcenter | author | manager | editor | ms.assetid | ms.service | ms.workload | ms.tgt_pltfrm | ms.devlang | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Get Started with Mobile Apps by using Xamarin.Forms |
Follow this tutorial to get started using Azure Mobile Apps for Xamarin.Forms development |
app-service\mobile |
xamarin |
adrianhall |
erikre |
5e692220-cc89-4548-96c8-35259722acf5 |
app-service-mobile |
mobile |
mobile-xamarin |
dotnet |
hero-article |
10/01/2016 |
adrianha |
[!INCLUDE app-service-mobile-selector-get-started]
This tutorial shows you how to add a cloud-based backend service to a Xamarin.Forms mobile app using an Azure Mobile App backend. You will create both a new Mobile App backend and a simple Todo list Xamarin.Forms app that stores app data in Azure.
Completing this tutorial is a prerequisite for all other Mobile Apps tutorials for Xamarin.Forms.
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 with Xamarin. See Setup and install for Visual Studio and Xamarin for instructions.
- A Mac with Xcode v7.0 or later and Xamarin Studio Community installed. See Setup and install for Visual Studio and Xamarin and Setup, install, and verifications for Mac users (MSDN).
Note
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you can immediately create a short-lived starter Mobile App in App Service. No credit cards required; no commitments.
Follow these steps to create a new Mobile App backend.
[!INCLUDE app-service-mobile-dotnet-backend-create-new-service]
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.
Follow the steps below to configure the server project to use either the Node.js or .NET backend.
[!INCLUDE app-service-mobile-configure-new-backend]
Here you have a couple of choices. You can download the solution to a Mac and open it in Xamarin Studio, or you can download the solution to a Windows computer and open it in Visual Studio using a networked Mac for building the iOS app. See Setup and install for Visual Studio and Xamarin if you need more detailed instructions on the Xamarin setup scenarios.
Let's proceed:
-
On your Mac or on your Windows computer, open the Azure Portal in a browser window.
-
On the settings blade for your Mobile App, click Get Started (under Mobile) > Xamarin.Forms. Under step 3, click Create a new app if it's not already selected. Next click the Download button.
This downloads a project that contains a client application that is connected to your mobile app. Save the compressed project file to your local computer, and make a note of where you save it.
-
Extract the project that you downloaded, and then open it in Xamarin Studio or Visual Studio.
This section is for running the Xamarin iOS project for iOS devices. You can skip this section if you are not working with iOS devices.
- Right-click the iOS project, and then click Set As Startup Project.
- On the Run menu, click Start Debugging to build the project and start the app in the iPhone emulator.
-
Right-click the iOS project, and then click Set as StartUp Project.
-
On the Build menu, click Configuration Manager.
-
In the Configuration Manager dialog box, select the Build and Deploy checkboxes of the iOS project.
-
Press the F5 key to build the project and start the app in the iPhone emulator.
[!NOTE] If you have problems building, run NuGet package manager and update to the latest version of the Xamarin support packages. Sometimes the Quickstart projects may lag behind in being updated to the latest.
In the app, type meaningful text, such as Learn Xamarin and then click the + button.
This sends a POST request to the new mobile app backend hosted in Azure. 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 is displayed in the list.
Note
You'll find the code that accesses your mobile app backend in the TodoItemManager.cs C# file of the portable class library project of your solution.
This section is for running the Xamarin droid project for Android. You can skip this section if you are not working with Android devices.
- Right-click the Android project, and then click Set As Startup Project.
- On the Run menu, click Start Debugging to build the project and start the app in an Android emulator.
-
Right-click the Android (Droid) project, and then click Set as StartUp Project.
-
On the Build menu, click Configuration Manager.
-
In the Configuration Manager dialog box, select the Build and Deploy checkboxes of the Android project.
-
Press the F5 key to build the project and start the app in an Android emulator.
[!NOTE] If you have problems building, run NuGet package manager and update to the latest version of the Xamarin support packages. Sometimes the Quickstart projects may lag behind in being updated to the latest.
In the app, type meaningful text, such as Learn Xamarin and then click the + button.
This sends a POST request to the new mobile app backend hosted in Azure. 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 is displayed in the list.
Note
You'll find the code that accesses your mobile app backend in the TodoItemManager.cs C# file of the portable class library project of your solution.
This section is for running the Xamarin WinApp project for Windows devices. You can skip this section if you are not working with Windows devices.
-
Right-click any of the Windows projects, and then click Set as StartUp Project.
-
On the Build menu, click Configuration Manager.
-
In the Configuration Manager dialog box, select the Build and Deploy checkboxes of the Windows project that you chose.
-
Press the F5 key to build the project and start the app in a Windows emulator.
[!NOTE] If you have problems building, run NuGet package manager and update to the latest version of the Xamarin support packages. Sometimes the Quickstart projects may lag behind in being updated to the latest.
In the app, type meaningful text, such as Learn Xamarin and then click the + button.
This sends a POST request to the new mobile app backend hosted in Azure. 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 is displayed in the list.
Note
You'll find the code that accesses your mobile app backend in the TodoItemManager.cs C# file of the portable class library project of your solution.
- 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. - How to use the managed client for Azure Mobile Apps
Learn how to work with the managed client SDK in your Xamarin app.