If You Can WebDev, You Can Mobile

Last year Microsoft embraced the Cordova framework and embedded it within Visual Studio. In doing so, in one fell swoop, they gave the huge community of visual studio web developers the ability to start developing natively installed mobile apps, within visual studio. Cordova Tools for Visual Studio is a framework and set of templates that enable you to develop applications that are downloaded from the app/play store and install and act just like native mobile applications - the only difference is you dont need to learn Java or ObjectiveC!

Cordova tools are included in the free community version of Visual Studio, so it's worth a look at the very least. The message to take from this article is - if you are a visual studio web developer right now, you can start developing for mobile apps without having to learn any new skills - it's awesome!

So how is this magic achieved? ... In brief, what happens is that you develop using things you are familiar with ... HTML/CSS/JavaScript. These are displayed and executed inside a mobile 'webview' that is contained in a wrapper that runs natively on the mobile device. The wrapper is built to give access to aspects of the native device through Javascript APIs. This means you can write a powerful mobile app that works offline, and can harness all of the native aspects of the device including camera, compass, gps, vibration, etc. Make no mistake, this is not a simple HTML5 'offline' app - this operates natively, and is known as a 'Hybrid' application. The underlying technology is built on the well established Cordova framework. However, historically, using Cordova meant Visual Studio developers mostly left their valuable tooling behind. TACO (tools for apache cordova) does all of the heavy lifting needed to build and connect to native devices for testing and debugging, allowing you to develop performant mobile applications for Android, Windows and iPhone.

When you install VS Cordova, there are a lot of dependencies that come along with it. The reason for 'all of the things' is simple - giving you literally, one-click deploy to device, is not a simple matter. It involves a lot of orchestration of tooling, a lot of moving parts, and of course, just a sprinkling, of magic unicorn dust!
The majority of developers that I know are involved in enterprise development, producing solutions for business and commerce. It is in this sphere that TACO shines. Building business apps does not require heavy use of graphics, is not reliant on speedy processors and is generally about information and form related data. For this target environment, TACO is perfect. If you need to design games, sure, for lightweight offerings you can use a framework like PHASER, but in general apps that are very speed and graphics heavy most development houses will go straight to raw native. 

Developing for hybrid mobile is best done by writing a single page application. There are good reasons for this that you can read on the Interwebs. I will explain the details in another article at a later stage. When writing a simple single page application you can of course use your own simple code., but be careful! Once your application becomes more than 3..4 pages, you really should consider using a framework. This can be something lightweight like a combination of a router like SammyJS and a UI framework like bootstrap, or you can use a framework that's built from the ground up for hybrid mobile like Sencha or the Ionic Framework. Ionic is based on the Angular framework, and as such is incredibly powerful, feature rich and critically, very robust.

There is one major benefit to writing hybrid apps that should not be discounted. Clearly, to get an app to a user, you must place your app on the play or app store - this takes time, requires that you go through the approval process etc. Depending on the platform (Windows, Apple, Google), it can take hours or days. Once you have your app published, for each subsequent version update you make, you need to resubmit to the app-store ... and good luck if you launch your app with a bad bug and have to get it out to users quickly ... clearly this is a problem. Thanks to some other clever technology from Microsoft, this problem, at least for Hybrid developers, has been solved. Called 'CodePush', this technology solution allows you to make minor or major changes to your app locally, on your machine, and push these out live to your mobile users, bypassing the various app stores. Its very simple, but works like magic.

Getting started and really dug into Hybrid mobile development requires more than a simple introduction like this. I have a backlog of mobile development with VS Taco articles ready to write and look forward to finalising them. In the meantime however, I urge you to have a look at the build session given by Ryan Salva of Microsoft, and Max Lynch of Ionic, and learn how together, they made the //BUILD mobile app, using a combination of Visual Studio, Azure mobile services, Ionic, and Code Push. Heres the link, do yourself a favor and take an hour out to be inspired about how you can use your WebFoo, do to Mobile-too :)

Useful links: