Book Image

Learning Firefox OS Application Development

By : Tanay Pant
Book Image

Learning Firefox OS Application Development

By: Tanay Pant

Overview of this book

With broad compatibility, the latest in web technologies, and powerful development tools, Firefox is a great choice for both web developers and end users. Firefox OS’s promotion of HTML5 as a first class citizen opens up the walled gardens of mobile application development for web developers. It is because of this initiative that no special SDKs are required to develop for Firefox OS. This book will help you excel in the art of developing applications for Firefox OS. It sequentially covers knowledge building, skills acquisition, and practical applications. Starting with an introduction to Firefox OS, usage of WebIDE, and then the application structure, this book introduces applications of increasing complexity with each chapter. An application that measures your tapping speed, a geolocation tagging application, and a photo editing and sharing application are the three applications that will be built from scratch. You will learn about topics such as the difference between various types of Firefox OS applications, application manifest files, offline apps, and designing principles for applications. You will also learn to test and submit the applications to the marketplace and finally maintain the repository of the Firefox OS application. By the end, you will be able to develop beautifully designed, fully-fledged, and rigorously tested Firefox OS applications and also share them at the Firefox OS Marketplace.
Table of Contents (17 chapters)
Learning Firefox OS Application Development
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The architecture of Firefox OS


The architecture of Firefox OS is a bit different from other mobile operating systems. There are three levels of abstraction in Firefox OS: Gonk, Gecko, and Gaia.

Mobile hardware

Mobile hardware refers to the various components present in a mobile, such as the battery, sensors, camera, GPS, Bluetooth, and other things, that are crucial for the interaction of the operating system with the device and environment. The interaction of these various components with the operating system is what makes the experience of smartphones unique compared to the previous generation of phones, called feature phones.

Gonk – the kernel

Firefox OS's kernel is built in the Android Open Source Project, which itself is a Linux kernel, and is the lowest level in the abstraction structure of the operating system. Gonk acts as the interface between the underlying hardware and Gecko. It deals with all the complex tasks of abstracting the hardware such that the components of the mobile device such as Bluetooth, camera, and sensors can be accessed via Gecko. Thus, Gonk is responsible for exposing the features of the chipset to be used via the WebAPIs to Gecko.

Gecko – the engine

Gecko is the web engine that connects components such as HTML and JavaScript to the underlying low-level layer of Gecko. Gecko is the same HTML parsing and rendering engine that is used in the Firefox web browser. However, a certain web renderer of Gecko is used for this project just as different variants of Gecko are used for Firefox, Windows, Android, and OS X. Gecko is responsible for handling details such as providing access to the hardware via secure APIs. It consists of a robust security framework and it also handles the update management, along with various other core services. It is basically an application runtime layer.

Gaia – the interface

Gaia is the user interface part of Firefox OS. It is what we actually see in the OS. The app launcher and all the default applications such as camera, dialer, and settings are part of Gaia, and are completely built using HTML, CSS and JavaScript. This is the final layer of Firefox OS. Gaia exposes the WebAPIs for developers to interact with Gecko and the underlying hardware. As Firefox OS is completely open source and available online on GitHub (Gaia) and Mercurial (Gecko and Gonk), it gives full access to the user so that they can tweak the default look and feel of Firefox OS to suit their personal or organizational needs.

Firefox OS applications

Next are the third-party applications that are made by great developers like you and are running on Gaia. These applications run on top of Gaia and can be downloaded from the Firefox Marketplace. You will learn how to make these applications shortly after you study some essentials of Firefox OS.