MoEngage Docs

Geo Fence Push

Before configuring Geofences please make sure General Push Configuration is completed.

By default SDK does not track location neither geo-fence campaigns work by default.
To track location and run geo-fence campaigns you need to opt-in for location service in the MoEngage initialiser.
To initialise call the below opt-in API.

    MoEngage moEngage =
        new MoEngage.Builder(this, "XXXXXXXXXXX")
            .enableLocationServices()
            .build();
    MoEngage.initialise(moEngage);

Note

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

Geofence hit callbacks

Geofence hit callbacks are listeners to notify the application whenever a geofence is triggered.
To get a callback implement the below interface.

Minimum SDK version required : 7.7.05

  /**
   * Callback for geo-fence hit
   */
  public interface OnGeoFenceHit{
    /**
     * Callback triggered whenever geo-fence hit
     * @param geoFenceHit Intent received from google's location services
     * @return true if the app wants to consume the hit and don't want MoEngage SDK to take any
     * action on this hit, else false
     */
    boolean geoHit(Intent geoFenceHit);
  }

Register the listener

To get a callback register a listener as shown below, in the Application class's onCreate()

//pass the instance of the above implemented interface
MoELocationCallbacks.getInstance().setGeoFenceHitListener();

Geo Fence Push


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.