Location Triggered

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

Screenshot 2023-08-11 at 11.16.46 AM.png

Initialization

Add MoEGeofenceGameObject.cs to the same object created in the Unity Initialization step and set the App Id

Screenshot 2023-08-17 at 2.05.15 PM.png

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 on Geofence.

iOS Configuration

Post integration with the geofence package make sure to  Build and Replace for iOS.

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

c#
using MoEngage;
MoEngageGeofenceClient.StartGeofenceMonitoring();

Stop Geofence Monitoring

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

c#
using MoEngage;
MoEngageGeofenceClient.StopGeofenceMonitoring();

Previous

Next

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

How can we improve this article?