Log In

Your application can listen to location enter or exit events.
Before deep diving into the available methods, lets briefly see what kind of location objects does MOCA define:

Location related classes

MOCABeacon: A bluetooth beacon.
MOCAZone: A Group of MOCABeacon.
MOCAPlace: A region defined by a geofence. It could contain multiple MOCAZone
MOCARegionGroup: Flexible class that can contain multiple MOCABeacon, MOCAZone or MOCAPlace .

All classes above inherit from MOCARegion

Available methods

Location event listeners are segregated in several interfaces so you can pick what works best for your use case.

Listening to all region type events:

interface RegionEventsObserver extends IObserverHandler.ObserverId {
  default void onEnterRegion(MOCARegion region){}
  default void onExitRegion(MOCARegion region){};

If you want to listen only a specific type of regions. Implement the appropriate protocol.

interface PlaceEventsObserver extends RegionEventsObserver {
  void onEnterPlace(MOCAPlace region);
  void onExitPlace(MOCAPlace region);

interface ZoneEventsObserver extends RegionEventsObserver {
  void onEnterZone(MOCAZone region);
  void onExitZone(MOCAZone region);

interface BeaconEventsObserver extends RegionEventsObserver {
  void onEnterBeacon(MOCABeacon region);
  void onExitBeacon(MOCABeacon region);

interface RegionGroupEventsObserver extends RegionEventsObserver {
  void onEnterRegionGroup(MOCARegionGroup region);
  void onExitRegionGroup(MOCARegionGroup region);

Install an observer by calling