Building Android apps with the Nomad extension for Visual Studio 2010
August 14, 2012 3 Comments
Last week I posted an article entitled Extending PhoneGap for Visual Studio to Android devices. In it I talked about how we can use the Visual Studio 2010 PhoneGap templates to create a Windows Phone 7 app and deploy it to an Android mobile device using the PhoneGap:Build service.
Well there is another piece of technology that I have been playing with lately that goes beyond PhoneGap:Build by baking the compilation service right into the Visual Studio IDE. The product is called Nomad and it is made by Red Gate Software in England. Right now it is in free private beta but anyone can request a copy of the product.
Much like the PhoneGap templates you will build apps using HTML5 and CSS. You can use the PhoneGap libraries to access items like the camera and accelerometer. You can even use things like jQuery Mobile. All of this will get compiled down to an application that can be deployed to a mobile device. You cannot as yet deploy a Nomad project to the Google Play store though. (See the comments below for an update.)
Right now Nomad only supports builds for Android and iOS. As with the PhoneGap templates you will need to have a membership with the iOS Developer Program before you can build an app for iOS. As well Nomad is limited to Visual Studio 2010 but not available for the Express editions as they do not allow extensions. Finally, Nomad only targets iOS 4.2 or later and Android 2.2 (Froyo) or later.
In the remainder of this post I will demonstrate how to use Nomad to build and deploy an app to an Android mobile device.
Once you send a request to Nomad you will get an email response with a download link. Download the Visual Studio extension and save it to your computer. Run the .visx file and follow the instructions to install the extension into Visual Studio. You may need to restart it if it was running during installation.
With the extension now installed open Visual Studio and select File | New Project. Find the VS Nomad Project within the Installed Templates. Enter a Name and Location. Click OK.
Nomad will raise a message box on first use asking you to sign in with the account details from the email that contained your download link. Your user name is the email address you signed up with.
You will see the default project is set up to use PhoneGap services like the compass and geolocation. However since we are running in the localhost we cannot access these items and thus the page shows an “n/a” beside these properties.
To start building your project you would want to clean out the index.html and start laying in your own code. However for this demonstration I want to use the provided demo code to show you how the PhoneGap tools in use on this page will actually work once compiled and placed on a mobile device.
To build your Nomad project find the Nomad build button on your toolbar. Click the drop down arrow beside the build button and select Build for Android. You can also select Build configured platforms if you want packages for both iOS and Android (provided you have the requisite iOS developer account).
After you select the Build button the code gets packaged up and sent to the Nomad cloud build service on Nomad’s servers. This means that you do not need additional SDKs or any other software to compile your app.
Once you click the Build button you will see a processing message.
And once it is completed you should get a success message if everything compiles correctly.
Clicking the Show in Windows Explorer button on the dialog box will take you to your project folder. The build process creates a “distrib” folder and your compiled app is placed in there. Since I built an Android app I received a .apk file back.
Once the item is saved to my computer I can then move the app to an Android mobile device for installation. To deploy the .apk file to my Samsung Galaxy Tab 2 10.1 Android tablet I will copy the file from my computer to my Dropbox folder. If you do not have one you can create a Dropbox account here. (Full disclosure: this is my referral link).
To install the app click your file on Dropbox to begin downloading it to the Download folder on your device. Once the .apk file is in your folder click it to begin the installation process.
Note: To install apps that do not come from a recognized Android marketplace you will need to make sure that you allow installation of non-Market applications. To do this go to Settings | Applications and click the Unknown Sources checkbox.
Once the app is installed you will see it in your list of Apps. Here is my Nomad Hello World app. You can see that once the device is loaded onto my tablet that the Compass, Connection, Device and Geolocation properties all present working data.
As you can see from this demonstration the Nomad extension for Visual Studio 2010 allows you to create a working Android application within a Microsoft environment. Although the Android app is only available for private use once they allow deploys to the Google Play store you are well on your way to creating Android apps within the Visual Studio 2010 IDE.
Leave a comment below and let me know what types of projects you would use the Nomad extension for.