Microsoft Azure : Mobile Services - Xamarian.Android with .Net - Blogs

Microsoft Azure : Mobile Services - Xamarian.Android with .Net

NOTE: Microsoft Azure recommends Azure App Service Mobile Apps for all new mobile backend deployments.


We will add a cloud-based backend service to Xamarin Android app using Azure Mobile Services. We will create both new mobile service and simple To do list app that stores app data in new mobile service. Mobile service that we will create uses supported .NET languages using Visual Studio for server-side business logic and to manage mobile service. To create mobile service that lets us write our server-side business logic in JavaScript.


NOTE: We will create new mobile service project by using Azure classic portal. By using Visual Studio 2013 Update 2, we can also add a new mobile service project to existing Visual Studio solution.



We need Azure account.


Create new mobile service

Follow these steps to create new mobile service.

1)    Log into . At bottom of navigation pane, click +NEW. Expand Compute and Mobile Service, then click Create.

This displays Create a Mobile Service dialog.






2)    In Create a Mobile Service page, select Create a free 20 MB SQL Database, select .NET runtime, then type subdomain name for new mobile service in URL textbox. Click right arrow button to go to next page.

This displays Specify database settings page.




NOTE: We create new SQL Database instance and server. We can reuse this new database and administer it as we would any other SQL Database instance. If we already have database in same region as new mobile service, we can instead choose Use existing Database and then select that database. Use of a database in different region is not recommended because of additional bandwidth costs and higher latencies.


3)    In Name, type name of new database, then type Login name, which is administrator login name for new SQL Database server, type and confirm password and click check button to complete process.






You have now created new mobile service that can be used by our mobile apps.




Create new Xamarin Android app

Once we have created our mobile service, we can follow an easy quickstart in Azure classic portal to either create new app or modify existing app to connect to our mobile service.

We will download new Xamarin Android app and service project for our mobile service.

1)    In , click Mobile Services and then click mobile service that we just created.






2)    In quickstart tab, click Xamarin under Choose platform and expand Create a new Xamarin app.

This displays three easy steps to create Xamarin Android app connected to our mobile service.


3)    If we haven't already done so, download and install Visual Studio Professional 2013 on our local computer or virtual machine.

4)    If we haven't already done so, download and install Xamarin Studio or Xamarin for Visual Studio.

5)    Under Download and publish your service to the cloud, select Android and click Download.

This downloads solution contains projects for both mobile service and for sample To do list application that is connected to our mobile service. Save compressed project file to our local computer and make note of where we save it.




6)    Download our publish profile, save downloaded file to our local computer and make note of where we save it.


Test mobile service

Mobile service project lets us run our new mobile service locally. This makes it easy to debug our service code before we even publish it to Azure.

1)    On our Windows PC, download our personalized server project, extract it and then open it in Visual Studio.




2)    Press F5 key to rebuild project and start mobile service locally. Web page is displayed after mobile service starts successfully.




Publish our mobile service

1)      In Visual Studio, right-click project, click Publish >> Microsoft Azure Mobile Services. Instead of using Visual Studio, we may also use Git.






2)      Sign in with Azure credentials and select our service from Existing Mobile Services. Visual Studio downloads our publish settings directly from Azure. Finally, click Publish.














Run Xamarin Android app

Final stage is to build and run our new app.

1)    Navigate to client project within mobile service solution, in either Visual Studio or Xamarin Studio.

2)    Press Run button to build project and start app. We will be asked to select emulator or connected USB device.








NOTE: To be able to run the Android emulator, we must define least one Android Virtual Device. Use the AVD Manager to create and manage these devices.


3)    In app, type meaningful text, such as Complete the tutorial and then click plus icon.

This sends POST request to new mobile service hosted in Azure. Data from request is inserted into TodoItem table. Items stored in table are returned by mobile service and data is displayed in list.


NOTE: We can review code that access our mobile service to query and insert data, which is found in ToDoActivity.cs c# file.



Azure App Service Scaling Features And Capabilities

How to scale the application in Azure App Service. There are two workflows for scaling, scale up and...

Read More >

Azure App Service (Build And Host Web Apps, Mobile-Back Ends Without Managing Infrastructure)

In this blog we will see what is Azure App Service, and it’s  features and why do we use it, we can...

Read More >

Azure Blob Storage: The PowerShell Way!

Hi folks!Great to see you again.This blog post is purely based on Azure Blob Storage: The PowerShell...

Read More >

Create a Windows Server 2012 R2 VM using ARM in Azure PowerShell

Hi Folks,In this Blog Post we will learn how to create an Azure ARM Virtual Machine using Azure Powe...

Read More >

Continuous Integration/ Continuous Deployment VSTS

Following the below steps you can build and deploy your ASP.NET  app to Azure from either Visua...

Read More >

How to Sync On-premise AD with Windows Azure AD using Azure AD Connect tool

 Azure AD is a service that provides identity and access management capabilities in the cloud. ...

Read More >

Creating a Point-to-Site Connectivity using Azure Resource Manager

Configure a Point-to-Site connectivity to a VNet using PowerShell (ARM Mode)Task 1: Create a Self-Si...

Read More >

How to Create an Azure Virtual Network by using a Deployment Template

Hello Folks!In this Blog post, we will try to learn how to create an Azure V-Net using an ARM templa...

Read More >

Locking VMs and Resources Groups with Azure Resource Manager using Azure PowerShell

Hello Folks!In this blog post we will be talking about locking down your Azure Resources with Azure ...

Read More >

Microsoft Azure: Implementing Internet Facing Load Balancers using Azure Resource Manager

Howdy Folks!I was exploring Network Load Balancer in Azure Resource Manager and found out that you c...

Read More >


Try DevOpSmartBoard Ultimate complete Azure DevOps End-to end reporting tool

Sign Up

  • Recent
  • Popular
  • Tag
Monthly Archive

Contact Us
  • *
  • *