Geolocation and geofencing

Prev Next

The Mapp Engage Flutter plugin supports geolocation-based engagement through geofencing. This allows you to trigger actions when a user enters or exits predefined geographic areas.

Geofencing is currently supported on Android only in SDK v0.0.13.

Platform support

Geofencing is available only on Android.

  • Android: Supported

  • iOS: Not supported

Do not call geofencing methods on iOS, as they are not available in this SDK version.


Required permissions

Before using geofencing, you must declare the required location permissions in your Android project.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

These permissions allow the SDK to monitor location changes and trigger geofence events.


Start geofencing

Use startGeoFencing() to begin monitoring geofences.

final String status = await MappSdk.startGeoFencing();
print('Geofencing started: $status');

This enables background monitoring of configured geofences.


Stop geofencing

Use stopGeoFencing() to stop monitoring geofences.

final String status = await MappSdk.stopGeoFencing();
print('Geofencing stopped: $status');

This disables geofence tracking on the device.


How geofencing works

Geofencing relies on predefined geographic areas configured in Mapp Engage. When the device enters or exits these areas, the SDK can trigger engagement actions such as push notifications or in-app messages.

Geofencing depends on:

  • Location permissions granted by the user

  • Device location services enabled

  • Configured geofences in the Mapp dashboard


Recommended usage flow

  1. Declare required location permissions in AndroidManifest.xml

  2. Request location permission from the user (if required by your app)

  3. Initialize the SDK

  4. Call startGeoFencing() to enable monitoring

  5. Call stopGeoFencing() when geofencing is no longer needed

This ensures that geofencing is enabled only when your app is ready to use it.


Common mistakes

  • Calling geofencing methods on iOS

  • Missing required location permissions in AndroidManifest.xml

  • Not requesting location permission from the user

  • Expecting geofencing to work without configured geofences in Mapp Engage


Best practices

  • Request location permission with clear user context

  • Enable geofencing only when it provides value to the user

  • Handle permission denial gracefully

  • Monitor geofencing status during development using logs