Gather and modify data

A lot of what you'll want to do involves retrieving data — from files, the device hardware and key services, and the location around the device. This set of articles covers such functionality in detail.

From the device hardware

Responding to light conditions with the Ambient Light API
Ambient light sensors detect the presence and intensity of visible light. If used in a smart way, ambient light sensing optimizes visibility and battery life of portable devices such as tablets, smartphones, and laptops. This article looks at one way to respond to light conditions in the context of Open Web Apps: The Ambient Light API. Using this we can get information on the ambient light level and take actions to improve readability or create special effects dependant on light conditions.
Retrieving battery status information via the Battery Status API
This article deconstructs a web application - the Low Energy Messenger - which uses battery status information to turn off high energy functions such as taking pictures when the device's battery is low. This presents a valid real world use case for the Battery Status API, plus an object-oriented JavaScript structure for handling the battery status functions.
Optimizing for high and low network speeds
Network connectivity is a big issue for mobile apps, and network usage has many costs associated with it: battery life, performance and in some cases actual data transfer costs. These aspects should always be considered when designing and building cross platform Web Apps. This article explores a technology that facilitates optimization for high and low network speeds in the context of Open Web Apps: The Network Information API.
Plotting yourself on the map
The Geolocation API, along with services such as Google Maps and OpenStreetMap, provides a great way to gather data about the user's surroundings — where they are, and what they can find nearby. This article gives a detailed account of how to build up a Geolocation application.
Keep it level: responding to device orientation changes
This article explores motion and orientation sensors (detecting when the device is tilted in different directions, for example) and associated W3C specifications, and explains how to makes use of such data in an HTML5 game written for the open web and Firefox OS devices.
Updating phone contacts from the Web
Open web apps can benefit from integrating with the address books of devices they are installed on, especially on mobile devices in which contacts can be combined usefully with other data such as geolocation for personalised user experiences. This article explains how to build a real-world Firefox OS app that makes use of the API involved in managing phone contacts: the Contacts API.

From third party services


  • File API
  • Device storage API
  • File handle API
  • Camera
  • gUM/WebRTC

Web activities could fit well with a lot of these things. For email, and other things (

Document Tags and Contributors

Contributors to this page: FredB, franciov, chrisdavidmills
Last updated by: franciov,