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 listening is segregated in several interfaces so you can pick what works best for your use case.
Listening to all region type events:
@protocol RegionEventsObserver <MOCAObserverId>
@optional
- (void)didEnterRegion:(MOCARegion *)region;
- (void)didExitRegion:(MOCARegion *)region;
@end
If you want to listen only a specific type of regions. Implement the appropriate protocol.
@protocol RegionGroupEventsObserver <RegionEventsObserver>
- (void)didEnterRegionGroup:(MOCARegionGroup *)regionGroup;
- (void)didExitRegionGroup:(MOCARegionGroup *)regionGroup;
@end
@protocol PlaceEventsObserver <RegionEventsObserver>
- (void)didEnterPlace:(MOCAPlace *)place;
- (void)didExitPlace:(MOCAPlace *)place;
@end
@protocol ZoneEventsObserver <RegionEventsObserver>
- (void)didEnterZone:(MOCAZone *)zone;
- (void)didExitZone:(MOCAZone *)zone;
@end
@protocol BeaconEventsObserver <RegionEventsObserver>
- (void)didEnterBeacon:(MOCABeacon *)beacon;
- (void)didExitBeacon:(MOCABeacon *)beacon;
- (void) didRangeBeacon:(MOCABeacon *)beacon
withProximity:(CLProximity)proximity;
@end