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.
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.
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() }