Geofence Monitoring

Geofence Monitoring

Once you have integrated and initialized Locally’s Android and/or iOS EngageSDKs, you’ll be able to monitor location-based marketing for a delimited, actual geographical area (aka a “geofence“)  from right within your app!

Android Applications

For Android Applications, Geofence monitoring can be both started and stopped.

When monitoring Geofences for Android Applications, a radius and refresh interval are defined. By default, these values are: a radius of 500 miles, refreshed every 10 mins (measured in miliseconds).

Start Geofence Monitoring

private fun startMonitoring(){
            EngageSDK.startMonitoringGeofences(radius = 500, refresh = 600000) 
        }

Monitor Geofences and Beacons at the Same Time

You can monitor Geofences and Beacons at the same time:

private fun startMonitoring(){
            EngageSDK.startMonitoringGeofences(radius = 500, refresh = 600000)
            EngageSDK.startMonitoringBeacons() //to monitor for nearby beacons 
        }

Stop Geofence Monitoring

private fun stopMonitoring(){
            EngageSDK.stopMonitoringGeofences() 
        }

Listen for Events

To listen for events, set a listener override:


EngageSDK.setEventListener(object: EngageSDK.EventListener {
          override fun beaconCampaignUpdate(campaignContent: CampaignContent, time: String) {}

          override fun beaconUpdate(beacon: Beacon, time: String) {}

          override fun error(message: String, time: String) {}

          override fun geofenceCampaignUpdate(campaignContent: GeofenceCampaign.Campaign, time: String) {}

          override fun impressionUpdate(message: String, time: String) {}

          override fun locationUpdate(location: Location, time: String) {}
      })

iOS Applications

You can call Engage.startMonitoringGeofences from any place in your app.

The initialized closure is used to guarantee that startMonitoringGeofences is called only after the SDK has been initialized.

Engage.initialized = {
	Engage.startMonitoringGeofences()
}

Monitor Geofences and Beacons at the Same Time

You can monitor Geofences and Beacons at the same time:

Engage.initialized = {
Engage.startMonitoringBeacons()
	Engage.startMonitoringGeofences()
}