To integrate Geofence, Go to Unity Editor, navigating to
Assets > Import Package > Custom Package and import the
The above package is part of the
.zip file you downloaded during installation.
Prerequisites for Geofence
To use geofencing, your app must request the following:
- ACCESS_BACKGROUND_LOCATION if your app targets Android 10 (API level 29) or higher
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.
Add the Geofence configuration to
MoEngage.Builder while initializing the SDK using the
MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXXX") .configureGeofence(new GeofenceConfig(isGeofenceEnabled, isBackgroundSyncEnabled)) .build(); MoEngage.initialise(moEngage);
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:
using MoEngage; // Only for iOS MoEngageClient.StartGeofenceMonitoring();