#Mobile Services quickstart app for Apache Cordova Tools for Visual Studio
Mobile Services gets you started faster by providing a quickstart TodoList sample project for your mobile service, which you can download from the Azure Management portal. Sample projects are supported for most mobile device platforms, including PhoneGap/Cordova. These downloaded sample project are pre-configured to connect to your mobile service so that you can simply run the app and store items in Azure.
Apache Cordova Tools for Visual Studio let you work with Cordova and PhoneGap projects directly in the Visual Studio IDE. However, the current PhoneGap quickstart project download from the portal currently can't be opened directly in Visual Studio. This project contains an Apache Cordova Tools for Visual Studio project that is an equivalent quickstart app.
You need the following to be able to run this quickstart project:
- An Active Microsoft Azure subscription. You can sign-up for a trial account here.
- The Visual Studio Tools for Apache Cordova. See the topic Install Visual Studio Tools for Apache Cordova for the complete list of prerequisites for these tools.
You can use the Add Connected Service wizard in Visual Studio to connect your project to a mobile service, and even create a new mobile service. For this sample project, the easiest thing is to follow these steps:
-
Log on to the Azure Management Portal, click Mobile Services.
If you already created your mobile service and TodoItem table, skip down to step 5.
-
(Optional) If you haven't already created a Mobile Service, you can follow the steps at How to create a new mobile service.
-
(Optional) If you don't already have a TodoItem table, click the Data tab, click the Create button, supply a Table Name of
TodoItem
, then click the check button. -
Click the Dashboard tab and make a note of the value of your Mobile Service URL.
-
Click Manage Keys and make a note of the Application Key for your mobile service.
-
In the Solution Explorer in Visual Studio, navigate to the
\scripts
project subfolder and open the index.js file. -
Locate the MobileServiceClient constructor and replace the values of the
AppUrl
andAppKey
variables with the values you just obtained for your mobile service.
Now, your app is connected to your mobile service and you can store data in Azure.
##Build and test the app
-
Make sure that Visual Studio debugging is configured for the desired platforms.
-
Follow the instructions to run your app on one of the supported devices or emulators:
-
Once the app loads, type some text into the textbox and then click Add.
This sends a POST request to the new mobile service hosted in Azure. Data from the request is inserted into the TodoItem table.
-
Stop and then restart the app, or run it on a separate device, to verify that the previously inserted data is returned from the mobile service and displayed.