Mapbox has launched Mapbox Geofencing for iOS and Android. The new API makes it simpler to configure and manage geofenced areas and monitor when a device enters, exits, or remains within defined boundaries. Monitored device events can then trigger personalized actions, alerts, and notifications based on a user’s real-time, real-world location.
Virtual perimeters, real results
A ‘geofence’ is the term for a virtual boundary drawn around a real-world location. Geofences can be defined individually or programmatically, such as defining an automatic radius around points or using existing boundaries data like zipcodes, census blocks, or school zones.
Developers can use geofencing in diverse ways. Geofencing can help create smart, ‘Internet of Things’ (IoT) applications that automate tasks such as turning on smart home lights when a user arrives. In marketing or advertising, geofencing can deliver personalized promotions when a customer is near a retail location. Geofences can also be used to improve user safety or enforce regulatory compliance, such as switching a hybrid vehicle to electric mode in low-emission zones.
Mapbox provides scalable geofencing, online and offline
With Mapbox Geofencing, monitoring is handled on the client side, allowing it to function both online and offline. Applications can use location monitoring in both foreground and background modes. There are no set limits on the number of geofences managed with the API.
Mapbox geofencing supports point-radius and complex boundary geometries that enable precise monitoring of intricate spaces, including postal code areas, property boundaries, or groups of buildings—offering greater flexibility than the traditional approaches.
How to use Geofencing
Use the method geofencing.addFeature(..)
to add or update a geofence:
Use the method geofencing.removeFeature(..)
to remove a geofence:
Use the method geofencing.clearFeatures(..)
to remove all geofences:
The geofences added are persisted to storage. They will be available across app restarts.
These code examples are for Android. Click here for iOS information.
Configurable events
Mapbox Geofencing sends event triggers when app users enter, exit, or remain within a geofenced area. Developers can define dwell duration in minutes for each individual geofence for more granular control.
Flexible geofence data sources
Developers can upload geofences as GeoJSON files or dynamically generate them based on on-device data or customer inputs. It is also possible to use existing data products like Mapbox Boundaries or generate travel-time based geometries with the Mapbox Isochrone API.
Using geofences with marketing tools
Geofence events can be sent from the client application to centralized campaign management tools, allowing developers to build audiences, create segments, and run promotional campaigns more effectively based on collected data.
Minimize development effort
Android and iOS geofencing services both have platform-specific implementation differences. Third-party geofencing products often need to be integrated into a wider platform that offers more robust maps, search, and navigation solutions. With Mapbox Geofencing, customers unite their geofencing solution with the wider Mapbox platform. This saves development time and effort by skipping platform specific implementations and complicated third-party integrations.
Get started with Mapbox Geofencing
Mapbox Geofencing is currently in beta. View the release notes for iOS and Android to get started. Mapbox has included an example for building a geofence surrounding a user’s location with a dynamic highlight color that changes to indicate specific geofence events (iOS, Android). There is also an example for building a tappable map interface where users can generate an isochrone-based geometry that can be added as a custom geofence (iOS, Android).