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 for 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 been granted location permission.
To start geo-triggering:
function doStartGeoTriggering() { // The SDK needs be initialized and the app must have location permissions. if (device.platform === "iOS") { io.bluedot.cordova.plugin.iOSStartGeoTriggering( function () { console.log("Start Geotriggering Successful") }, function (error) { console.log("Start Geotriggering Failed with error: " + error) } ); } else if (device.platform === "Android") { const androidNotificationParams = { channelId: "Bluedot Cordova", channelName: "Bluedot Cordova", title: "Bluedot Foreground Service - Geo-triggering", content: "This app is running a foreground service using location services", notificationId: 123, }; io.bluedot.cordova.plugin.androidStartGeoTriggering( function () { console.log("Start Geotriggering Successful") }, function (error) { console.log("Start Geotriggering Failed with error: " + error) }, androidNotificationParams.channelId, androidNotificationParams.channelName, androidNotificationParams.title, androidNotificationParams.content, androidNotificationParams.notificationId ); } }
Register callback functions to receive Geo-triggering events.
As entry events may occur immediately upon starting Geo-triggering, it is recommended to subscribe to the events before starting the Geo-triggering service.
function subscribeToGeoTriggeringEvents() { // Register callbacks functions for receiving geo-triggering events io.bluedot.cordova.plugin.zoneInfoUpdateCallback( zoneUpdateCallbackFunction ); io.bluedot.cordova.plugin.enteredZoneCallback( zoneEnteredCallbackFunction ); io.bluedot.cordova.plugin.exitedZoneCallback( zoneExitedCallbackFunction ); // Then start the Geo-triggering service. } function zoneUpdateCallbackFunction( zoneInfos ) { console.log( "Zones updated for " + zoneInfos.length + " zones" ); } function zoneEntered( fenceInfo, zoneInfo, locationInfo, willCheckOut, customData ) { console.log("Zone entered"); } function zoneExited( fenceInfo, zoneInfo, date, dwellTime, customData ) { console.log("Zone exited"); }
If you only need geo-triggering for a limited period, once that period is over, you should stop the geo-triggering service.
io.bluedot.cordova.plugin.stopGeoTriggering( function () { console.log("Stop Geotriggering Successful") }, function (error) { console.log("Stop Geotriggering Failed with error: " + error) } );
You can use the isGeoTriggeringRunning
method to check the status of the Geo-triggering service.
io.bluedot.cordova.plugin.isGeoTriggeringRunning( function (isRunning) { console.log("Is Geo Triggering Running: " + isRunning) } );