What Web Can Do Today?

Can I rely on the Web Platform features to build my app?

An overview of the device integration HTML5 APIs

Geofencing

The Geofencing API allow authorized Web applications to define geographic areas and receive notifications when the device enters or leaves these areas without the need to periodically query the Geolocation API. Thanks to the Service Worker being employed that allows code execution outside of the lifecycle of the owning Web application, the notification may be also received while the app is not opened in the browser.

As of early 2020, no vendor implemented the API and the proposal seems to be abandoned.

There is however a new concept under experimentation in Google Chrome that might cover some of the aspects of Geofencing in the future - location-based Notification Triggers. See Task Scheduling for more information.

API glimpse

region = new CircularGeofenceRegion({name, latitude, longitude, radius})
Creates a circular region definition with the coordinates and radius specified.
serviceWorkerRegistration.geofencing.add(region, options)
Sets up a region to be watched for and subscribes to the notification when the device enters or leaves the region.
self.addEventListener('geofenceenter', listener)
An event fired when the device enters one of the defined regions, provided as event.geofence.region.
self.addEventListener('geofenceleave', listener)
An event fired when the device leaves one of the defined regions, provided as event.geofence.region.

Resources

Get in touch