The Geolocation API provides a common interface for locating the device, independently of the underlying technology (GPS, Wi-Fi networks identification, triangulation in cellular networks, etc.).
The DeviceOrientation Event Specification defines several DOM events that provide information about the physical orientation and motion of a hosting device. Most browsers support this specification, although various interoperability issues have arised. The work on the specification itself has been discontinued when the Geolocation Working Group was closed. It may fall in scope of the Devices and Sensors Working Group when the group recharters, with a view to reducing inconsistencies across implementations and finalizing the specification accordingly, while the group develops the more powerful Orientation Sensor specification in parallel.
Technologies in progress
The Generic Sensor API defines a framework for exposing sensor data to the Web platform in a consistent way. In particular, the specification defines a blueprint for writing specifications of concrete sensors along with an abstract
Sensor interface that can be extended to accommodate different sensor types.
A number of sensor APIs are being built on top of the Generic Sensor API. The Proximity Sensor specification defines an API to monitor the presence of nearby objects without physical contact. The Ambient Light Sensor specification defines an API to monitor the ambient light level or illuminance of the device's environment. The Battery Status API exposes information about the battery status of the hosting service (however, note the future of this last specification is uncertain due to identified potential privacy-invasive usage of the API).
The detection of motion is made possible by a combination of low-level and high-level motion sensor specifications, also built on top of the Generic Sensor API:
- the Accelerometer to obtain information about acceleration applied to the device's local three primary axes;
- the Gyroscope to monitor the rate of rotation around the device's local three primary axes;
- the Magnetometer to measure magnetic field around the device's local three primary axes;
- the Orientation Sensor to monitor the device's physical orientation in relation to a stationary 3D Cartesian coordinate system.
The Motion Sensors Explainer document is an introduction to low-level and high-level motion sensors, their relationship, inner workings and common use-cases.
The Geolocation Sensor is an API for obtaining geolocation reading from the hosting device. The feature set of the Geolocation Sensor is similar to that of the Geolocation API, but it is surfaced through the Generic Sensor API, allows continuous geotracking and geofencing (one-time alerts when a user crosses a specific area) operations in the background, improves security and privacy, and is extensible.
It is often useful to be able to lock the orientation of the screen; the Screen Orientation API allows not only to detect orientation change, but also to lock the orientation in a specific state.
- Geofencing API
- The ability to detect when a device enters a given geographical area would enable interactions and notifications based on the user's physical presence in a given place. The Geolocation Working Group started to work on a geofencing API to that effect. This work has been discontinued, partly out of struggles to find a good approach to permission needs that such an API triggers to protect users against privacy issues, and because the API depended on the Service Workers, which was not yet stable at the time. Work on this specification could resume in the future depending on interest from would-be implementers.
- Additional sensor specifications
- A number of additional sensor specifications have been considered in the past in the Device sand Sensors Working Group, for instance to expose changes in ambient humidity (proposal which predates the Generic Sensor API), the Barometer Sensor or the Thermometer Sensor. Work on these proposals could resume in the future depending on interest from would-be implementers.