Firefox OS Now With Cordova Support
Written by Ian Elliot   
Monday, 24 February 2014

This sounds crazy. Cordova, aka PhoneGap, is a system that allows web apps to run on mobile phones as native apps. Now Cordova supports Firefox OS. But Firefox OS native apps are web apps. What's the point?

It might seem crazy but this is a very clever move.

First it is worth making it clear that the Cordova support does not in some way convert Firefox OS web apps into "native" apps as a number of reports suggest.

Firefox OS "native" apps are web apps and Cordova apps targeting Firefox OS are just HTML/JavaScript/CSS based apps.

 

 

Firefox OS is attempting to build a standards-based API that will allow web apps, i.e. built using nothing but JavaScript, HTML and CSS, to run with the same access to the hardware as a native app.

Firefox OS either doesn't have native apps or web apps are its native apps, depending on how you look at it. 

The problem is that the standards are slow to evolve and it is something of a struggle to keep up with how things should be implemented. Also many of the standards are not implemented on other platforms, so building a web app for Firefox OS doesn't make it easy to port the app to other, perhaps more profitable, devices.

This means that Firefox OS has a slight problem acquiring the number of apps it needs to look credible in the market. 

This is where Apache Cordova comes in. 

On other mobile phones Cordova takes your web app and wraps it in a container that is a standard native app for that particular phone. The native container acts like a web browser for the HTML/JavaScript code.

In addition Cordova provides a range of special APIs that allow the JavaScript to interact with the phone's hardware and other systems at a level that would be impossible in a standard browser.  That is, the container loads and displays the web app and takes care of interfacing any JavaScript API calls that make use of the phone. 

This is a clever idea and you could think of it as providing a web app based OS within the original OS of the phone. 

The key to Cordova's importance to Firefox OS is that to write a Cordova app you make use of its well-defined APIs. If you want to access the camera, say, you call the camera object's getPicture method with a callback that makes use of the bitmap returned:

navigator.camera.getPicture(function (src) {
do something with the picture returned in src
});

This call is the same for all of the phones that Cordova supports.

Now consider doing the same job in Firefox OS. You either have to work out how to use a Web Activity or you wait until the full camera API, which is part of WebRTC, is complete. No matter how you implement the picture taking, it almost certainly won't work on any other phone as a native app and it isn't likely to work as a web app until mobile browsers catch up with the  WebAPIs that Mozilla is creating.

 

cordovaffos

 

What this all means is that you can use the Cordova APIs to write a web app that will run on Firefox OS with the help of a translation layer and on all of the other phones that are supported as native apps. 

This seems like a much better prospect.

Not only can you write new Cordova/Firefox OS apps, but existing Cordova apps should just work on Firefox OS with a minor addition. 

So keen on this idea is Mozilla that they have extended their "phones for apps" scheme to target Cordova apps. If you have an existing Cordova app you can show it to Mozilla and if they like it they will give you a Firefox phone to use help you make it run on Firefox OS. 

This is all very practical, but it does send the message that the HTML5 standards-based APIs that Mozilla and others are working on are just not up to the job at the moment and that Cordova's APIs are a de facto standard.

You may not like this conclusion but at the moment it seems to be true.

PhoneGapIcon

More Information

Building Cordova apps for Firefox OS

Phones for Cordova/PhoneGap Ports application.

Related Articles

Firefox OS Moves To 1.1  

More Support For Firefox OS   

ZTE To Sell Firefox Phones On e-Bay

Firefox Phones Go On Sale, Marketplace Opens

Getting Started With Firefox OS And Geeksphone Keon    

Getting Started with Firefox OS - The UX Building Blocks  

Getting started with PhoneGap

    

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

blog comments powered by Disqus

 

Banner


p5.js Bringing Processing To The Web
07/08/2014

p5.js is a JavaScript library that takes the core ideas of Processing and brings them to the web. The first public beta of this open source project has just been released.



Learn More About Intel RealSense Technology
11/08/2014

Intel recently announced a contest for designing apps for its groundbreaking RealSense platform. A webinar on Wednesday August 13th on how applications are changing as a result of gesture recognition  [ ... ]


More News

 

Last Updated ( Monday, 24 February 2014 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.