Location Triggered

Installation

Adding Geofence Plugin

Add cordova-moengage-geofence plugin to Cordova project as shown below :

Shell
$ cordova plugin add cordova-moengage-geofence

Android Installation

Download

Once you install the Flutter Plugin add MoEngage's native Android SDK dependency to the Android project of your application.
Navigate to android/app/build.gradle. Add the MoEngage Android SDK's dependency in the dependencies block.

build.gradle
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation("com.moengage:geofence:$sdkVersion")
}

where $sdkVersion should be replaced by the latest version of the MoEngage Geofence SDK

iOS

In the case of iOS, the native dependency is part of the Geofence Cordova SDK itself, so there is no need to include any additional dependency for supporting Geofence.

Configuration

Start Geofence Monitoring

After integrating the geofence package call startGeofenceMonitoring() method to initiate the geofence module, this will fetch the geofences around the current location of the user. Please take a look at the iOS doc and Android doc for more information on Geofence. By default, the geofence feature is not enabled. You need to call the startGeofenceMonitoring() to receive location-triggered push messages. 

Javascript
MoEGeofence.startGeofenceMonitoring("YOUR_Workspace_ID");

Stop Geofence Monitoring

If you want to stop the geofence monitoring or feature use the stopGeofenceMonitoring() API. This API will remove the existing geofences.

Javascript
MoEGeofence.stopGeofenceMonitoring("YOUR_Workspace_ID");

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?