SPSmartGeofenceManager
Objective-C
@interface SPSmartGeofenceManager : NSObject
/**
@return Singleton instance of SPSmartGeofenceManager
*/
+(instancetype)sharedInstance;
/** unavailable method, do not use */
-(instancetype) init __attribute__((unavailable("call sharedInstance instead")));
#pragma mark - Geofence CRUD
/**
Add a geofence to SPSmartMapView
Geofences will disappear when the application is restarted.
To get geofence trigger events, set your delegate by calling 'addDelegate:' and implement delegate methods 'didEnterGeofence' or 'didExitGeofence'
@param localRef localRef of the geofence
@param buildingRef buildingRef of the geofence
@param completionBlock called when the operation is finished
*/
-(void)addGeofence:(NSString*)localRef building:(NSString*)buildingRef completion:(nonnull void (^)(SPSmartGeofenceResponseType response))completionBlock;
/**
Remove a geofence with local reference and building reference
@param localRef localRef of the triggered geofence
@param buildingRef buildingRef of the triggered geofence
*/
-(void)removeGeofence:(NSString*)localRef building:(NSString*)buildingRef;
#pragma mark - Delegate methods
/**
Add listener
*/
-(void)addDelegate:(id<SPSmartGeofenceManagerDelegate>)delegate;
/**
Remove listener
*/
-(void)removeDelegate:(id<SPSmartGeofenceManagerDelegate>)delegate;
#pragma mark - Adding/Removing Beacon fences
/**
Add all beacon fences
*/
-(void)addBeaconfences;
/**
Remove all beacon fences
*/
-(void)removeBeaconfences;
/**
Add a beacon fence to SPSmartMapView
Beaconfence will disappear when the application is restarted
To get beacon geofence trigger events, set your delegate by calling 'addDelegate:' and implement delegate methods 'didEnterGeofence' or 'didExitGeofence'
@param beaconId local reference of the beacon
@param radiusInMeter radius of the beacon in meter unit
@param loiteringDelayInSecond time delay between before triggering 'dwell' type transitions in second unit
@param completionBlock called when operation is finished
*/
-(void)addBeaconfence:(NSString*)beaconId radius:(NSInteger)radiusInMeter loiteringDelay:(NSTimeInterval)loiteringDelayInSecond completion:(nonnull void (^)(SPSmartGeofenceResponseType response))completionBlock;
/**
Remove a beacon fence from SPSmartMapView
@param beaconId the id of the beacon
*/
-(void)removeBeaconfence:(NSString*)beaconId;
#pragma mark - Hit Test
@end
Swift
class SPSmartGeofenceManager : NSObject
Undocumented
-
Declaration
Objective-C
+ (nonnull instancetype)sharedInstance;Swift
class func sharedInstance() -> SelfReturn Value
Singleton instance of SPSmartGeofenceManager
-
Unavailable
call sharedInstance instead
unavailable method, do not use
Declaration
Objective-C
- (nonnull instancetype)init;
-
Add a geofence to SPSmartMapView
Geofences will disappear when the application is restarted.
To get geofence trigger events, set your delegate by calling ‘addDelegate:’ and implement delegate methods ‘didEnterGeofence’ or ‘didExitGeofence’
Declaration
Objective-C
- (void)addGeofence:(nonnull NSString *)localRef building:(nonnull NSString *)buildingRef completion: (nonnull void (^)(SPSmartGeofenceResponseType))completionBlock;Swift
func addGeofence(_ localRef: String, building buildingRef: String) async -> SPSmartGeofenceResponseTypeParameters
localReflocalRef of the geofence
buildingRefbuildingRef of the geofence
completionBlockcalled when the operation is finished
-
Remove a geofence with local reference and building reference
Declaration
Objective-C
- (void)removeGeofence:(nonnull NSString *)localRef building:(nonnull NSString *)buildingRef;Swift
func removeGeofence(_ localRef: String, building buildingRef: String)Parameters
localReflocalRef of the triggered geofence
buildingRefbuildingRef of the triggered geofence
-
Add listener
Declaration
Objective-C
- (void)addDelegate:(nonnull id<SPSmartGeofenceManagerDelegate>)delegate;Swift
func add(_ delegate: any SPSmartGeofenceManagerDelegate) -
Remove listener
Declaration
Objective-C
- (void)removeDelegate:(nonnull id<SPSmartGeofenceManagerDelegate>)delegate;Swift
func remove(_ delegate: any SPSmartGeofenceManagerDelegate)
-
Add all beacon fences
Declaration
Objective-C
- (void)addBeaconfences;Swift
func addBeaconfences() -
Remove all beacon fences
Declaration
Objective-C
- (void)removeBeaconfences;Swift
func removeBeaconfences() -
Add a beacon fence to SPSmartMapView
Beaconfence will disappear when the application is restarted
To get beacon geofence trigger events, set your delegate by calling ‘addDelegate:’ and implement delegate methods ‘didEnterGeofence’ or ‘didExitGeofence’
Declaration
Objective-C
- (void)addBeaconfence:(nonnull NSString *)beaconId radius:(NSInteger)radiusInMeter loiteringDelay:(NSTimeInterval)loiteringDelayInSecond completion: (nonnull void (^)(SPSmartGeofenceResponseType))completionBlock;Swift
func addBeaconfence(_ beaconId: String, radius radiusInMeter: Int, loiteringDelay loiteringDelayInSecond: TimeInterval) async -> SPSmartGeofenceResponseTypeParameters
beaconIdlocal reference of the beacon
radiusInMeterradius of the beacon in meter unit
loiteringDelayInSecondtime delay between before triggering ‘dwell’ type transitions in second unit
completionBlockcalled when operation is finished
-
Remove a beacon fence from SPSmartMapView
Declaration
Objective-C
- (void)removeBeaconfence:(nonnull NSString *)beaconId;Swift
func removeBeaconfence(_ beaconId: String)Parameters
beaconIdthe id of the beacon
SPSmartGeofenceManager Class Reference