Yes! We provide a listener/delegate that developers can use to be notified on geofence enter/exit. You could store the last-visited Place information clientside and use it within your app to provide a store-specific experience.
To get a better background on Places & geofences read up on it here as well as more information on Messaging with Places.
On Android:
For geofence enter/exit events, call Localytics.setLocationListener
:
/**
* Add a listener that will be notified of certain location callbacks.
* @param listener The object that will receive the callbacks. Pass in null
* to remove an existing listener.
*/
public static void setLocationListener(@Nullable LocationListener listener)
Your LocationListener can provide a callback for region (geofence) enter and exit:
/**
* Callback for when regions have been triggered with a particular event
*/
void localyticsDidTriggerRegions(@NonNull List<Region> regions,
@NonNull Region.Event event);
On iOS:
Localytics.LLLocationDelegate
is a protocol which defines methods to be called when geofences are triggered or updated. When you have implemented your delegate, call [Localytics setLocationDelegate: delegate]
after Localytics initialization to hook in your custom logic to perform additional actions on geofence triggering.
This delegate can include the method
- (void)localyticsDidTriggerRegions:(nonnull NSArray<LLRegion *> *)regions withEvent:(LLRegionEvent)event;
The regions included in the listener/delegate include the identifier as well as any extra attributes associated with the regions that were triggered, and the event indicates whether it was an enter or exit event.
You can also add callbacks to suppress or modify the content of a Places notification before it's shown.