> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-sdk-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Location Triggered

# Prerequisites

To use location triggered (Geofence) push, your app must request the following:

* ACCESS\_FINE\_LOCATION
* ACCESS\_BACKGROUND\_LOCATION if your app targets Android 10 (API level 29) or later.

<Info>
  For location triggered push to work, ensure your Application has the following enabled: Location permission, Play Services location library, and device's location.
</Info>

For more information, refer to [Android Request Geofences](https://developer.android.com/training/location/geofencing#RequestGeofences).

# SDK Installation

## Installing using BOM

Integration using BOM  is the recommended way of integration; refer to the [Install Using BOM](/android-sdk/sdk-integration/basic-integration/Install-Using-BOM) document. Once you have configured the BOM add the dependency in the *app/build.gradle* file as shown below

<CodeGroup>
  ```Groovy build.gradle theme={"theme":{"light":"github-light","dark":"github-dark"}}
  dependencies {
      ...
      implementation("com.moengage:geofence")
  }
  ```
</CodeGroup>

Once the BOM is configured, include the specific MoEngage modules required for the application. \
Note: Version numbers are not required for these dependencies; the BOM automatically manages them.

# Configure Geofence

By default, the geofence feature is not enabled. To enable the feature, call the below API.

<CodeGroup>
  ```kotlin Kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
  MoEGeofenceHelper.getInstance().startGeofenceMonitoring(context)
  ```

  ```java Java theme={"theme":{"light":"github-light","dark":"github-dark"}}
  MoEGeofenceHelper.getInstance().startGeofenceMonitoring(context);
  ```
</CodeGroup>

At any time if you want to stop the geofence monitoring or feature, use the below API. This API will remove the existing geofences.

<CodeGroup>
  ```kotlin Kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
  MoEGeofenceHelper.getInstance().stopGeofenceMonitoring(context)
  ```

  ```java Java theme={"theme":{"light":"github-light","dark":"github-dark"}}
  MoEGeofenceHelper.getInstance().stopGeofenceMonitoring(context);
  ```
</CodeGroup>

## Callback

MoEngage SDK optionally notifies the application whenever a Geo-Fence is triggered. If required, the application can consume the trigger and ask the SDK not to process it. Alternatively, the application can just use the callback for logging/analytical purposes and let MoEngage process the trigger.

For more information about implementing callback in the application using [*OnGeofenceHitListener*](https://moengage.github.io/android-api-reference/geofence/com.moengage.geofence.listener/-on-geofence-hit-listener/index.html).

Register the listener in the Application class *onCreate()* using [*MoEGeofenceHelper.getInstance().addListener()*](https://moengage.github.io/android-api-reference/geofence/com.moengage.geofence/-mo-e-geofence-helper/add-listener.html).
