Location Triggered 2.x.x

To integrate Geofence, Go to Unity Editor, navigating to Assets > Import Package > Custom Package and import the Geofence.unitypackage
The above package is part of the .zip file you downloaded during installation.

Android Configuration

Prerequisites for Geofence

To use geofencing, your app must request the following:

  • ACCESS_FINE_LOCATION
  • ACCESS_BACKGROUND_LOCATION if your app targets Android 10 (API level 29) or higher
warning

Warning

For Geofence pushes to work your Application should have location permission and Play Services' Location Library should be included.

Refer to the documentation for more details.

Configure Geofence

Add the Geofence configuration to MoEngage.Builder while initializing the SDK using the configureGeofence()

Java
MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXXX")
    .configureGeofence(new GeofenceConfig(isGeofenceEnabled, isBackgroundSyncEnabled))
    .build();
MoEngage.initialise(moEngage);

iOS Configuration

First, integrate the MoEngageGeofenceiOS unity package as mentioned in the initialization doc. Post which you will have to Build and Replace for iOS.

Post integrating the Geofence package, call StartGeofenceMonitoring() method as shown below to support geofence campaigns in your iOS app:

c#
using MoEngage;
// Only for iOS
MoEngageClient.StartGeofenceMonitoring();

Previous

Next

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

How can we improve this article?