Keon and Peak: Two Firefox OS smartphones tested
Browser Reloaded
A single program runs on the hardware described here, and that is the browser. The phone apps the user perceives as applications are technically sites that you open by clicking on a link. However, these are not static HTML pages but web applications. Thanks to many new Internet standards, the differences between native desktop programs are even more blurred now than was the case with the first generation of Ajax applications (Figure 8). Because it also works offline, the client-side JavaScript run-time environment is particularly in demand, but you can also use server-side programming.
The technologies attributed to HTML5 provide graphical and multimedia features that were impossible to implement without plugins in HTML4: Free-form drawing in real time (Canvas), animations (CSS3, SVG), sound without plugins ("audio" tag), and even OpenGL-based 3D graphics (WebGL). Modern browsers also store data sets locally (local storage, Files API) that far exceed the size of a cookie.
With IndexedDB, they can even provide a simple NoSQL database. Cache manifests instruct the browser to keep resources from the Internet even after terminating the online connection. Additionally, WebSockets and server-sent events finally implement true, two-way communication between client and server. Web workers launch background threads that do not block the GUI.
Regardless of whether these new APIs are mature enough to use on public websites, they are definitely available for apps in Firefox OS.
Table 2 lists the Mozilla documentation for the aforementioned technologies.
Table 2
New Web Technologies in Firefox
Hardware
Web applications that you expect to behave like normal Android or iOS apps need regular access to the hardware of the mobile device. The W3C Geolocation API [7] that lets a browser access the current GPS coordinates is a start, but obviously not enough: The phone apps need access to the cellular network status, display lighting, and battery status.
Hardware access is mainly controlled by Mozilla's Firefox OS focused Web API (Figure 9) [8]. A manifest [9] requests the permissions that the user can grant or deny a particular domain (application) [10].
Some rights are always reserved for locally installed apps (packaged apps), and some even only for privileged apps from the Mozilla App Store. They receive this status after a review by the store operator. Firefox assigns packaged apps to a pseudo-random domain locally during installation; this domain handles the rights management of the browser as for normal web pages.
Look and Feel
Certified apps (i.e., Firefox OS system applications) reside at the top level. They are the only apps given critical authorizations, such as the ability to dial a phone number. Again, these are web applications whose rights the browser manages in line with the guidelines of the Web API [8].
Despite the use of advanced HTML5 techniques, they do not feel like apps (Figure 10) while the programs run in a browser window. The Open Web Apps standard [11] lets you hide all of the browser elements. At the same time, a start icon appears in the Start menu of the Gaia GUI.
In Firefox OS, the starter icons end up on a home screen that looks no different from that of other mobile systems (Figure 11). The aforementioned app manifest governs the building of elements like the starter icon. Each web page can link apps with Firefox OS via a JavaScript interface [12].
Buy this article as PDF
(incl. VAT)