iOS SDK 15.6.7,
Android SDK 15.5.3,
Hello Screen Dynamic States,
Bluedot Cordova plugin 4.0.1,
Bluedot Xamarin Android wrapper 15.5.2,
Bluedot Xamarin iOS wrapper 15.6.6,
Bluedot React Native wrapper 2.3.0,
Geo-triggering allows the automatic detection of location context change events (such as entering or exiting a geofence, or crossing a Geoline™). For this capability, the SDK needs to be initialized and the app must have location permission.
To start geo-triggering, you should
BDLocationManager.instance()?.startGeoTriggering(){ error in guard error == nil else { print("There was an error starting geo-triggering with the Bluedot SDK: \(error.localizedDescription)") return } }
The startGeoTriggering
method should be called when the app is in the foreground. For more information refer to Location modules should be started from the foreground
Implement BDPGeoTriggeringEventDelegate
and register it with BDLocationManager
to receive Geo-triggering related callbacks.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { BDLocationManager.instance()?.geoTriggeringEventDelegate = self BDLocationManager.instance()?.initialize( withProjectId: "MyProjectId"){ error in guard error == nil else { print("Initialisation with Bluedot SDK failed \(error.localizedDescription)") return } } return true }
extension AppDelegate: BDPGeoTriggeringEventDelegate { func onZoneInfoUpdate(_ zoneInfos: Set<BDZoneInfo>) { print("My local cache of the zones has updated!") } func didEnterZone(_ enterEvent: BDZoneEntryEvent){ print("I have entered a zone.") } func didExitZone(_ exitEvent: BDZoneExitEvent) { print("I have exited a zone") } }
If you only need geo-triggering for a limited period, once that period is over, you can stop the geo-trigger service.
BDLocationManager.instance()?.stopGeoTriggering(){ error in guard error == nil else { print("There was an error stopping geo-triggering with the Bluedot SDK: \(error.localizedDescription)") return } }
To start Geo-triggering with app restart notification, notification permission must be granted.