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,
Starting geo-triggering on foreground mode would require notification permissions. From Android 13, you have to request user for notification permissions.
To run geo triggering on foreground mode, you have to set notification details as below. If any of the parameters below are null or blank (except for androidNotificationId
), geo-triggering will start on background mode.
Parameters | Type | Description |
channelId | String? | The channel id of the notification. |
channelName | String? | The channel name of the notification. |
androidNotificationTitle | String? | The title of the notification. |
androidNotificationContent | String? | The content of the notification. |
androidNotificationId | int? | The notification Id of the notification. |
String channelId = 'Your channel Id'; String channelName = 'Your channel Name'; String androidNotificationTitle = 'Your notification title'; String androidNotificationContent = 'Your notification content'; int androidNotificationId = 123; // Will be -1 by default if set to null. BluedotPointSdk.instance.geoTriggeringBuilder() .androidNotification(channelId, channelName, androidNotificationChannel, androidNotificationContent, androidNotificationId) .start().then((value) { //Handle geo triggering started successfully debugPrint('Geo-triggering has been started'); }).catchError((error) { //Handle error when start geo-triggering debugPrint('Failed to start geo-triggering. Error $error'); });
BluedotPointSdk.instance.geoTriggeringBuilder().start().then((value) { //Handle geo triggering started successfully debugPrint('Geo-triggering has been started'); }).catchError((error) { //Handle error when start geo-triggering debugPrint('Failed to start geo-triggering. Error $error'); });
Either of the methods above would start geo-triggering in iOS.
// Listen to Geo-triggering events final geoTriggeringEventChannel = MethodChannel(BluedotPointSdk.geoTriggering); geoTriggeringEventChannel.setMethodCallHandler((MethodCall call) async { var args = call.arguments; switch (call.method) { case GeoTriggeringEvents.onZoneInfoUpdate: debugPrint('On Zone Info Update: $args'); break; case GeoTriggeringEvents.didEnterZone: debugPrint('Did Enter Zone: $args'); break; case GeoTriggeringEvents.didExitZone: debugPrint('Did Exit Zone: $args'); break; default: break; } }); // Then start geo triggering service ...
BluedotPointSdk.instance.stopGeoTriggering().then((value) { // Successfully stop geo triggering debugPrint('Geo-triggering has been stopped'); }).catchError((error) { // Failed to stop geo triggering, handle error in here debugPrint('Failed to stop geo triggering. Error $error'); });
BluedotPointSdk.instance.isGeoTriggeringRunning().then((value) { setState(() { debugPrint('Is Geo Running: $value'); }); });
import 'package:bluedot_point_sdk/bluedot_point_sdk.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override State<MyApp> createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { // The SDK needs be initialized and the app must have location permissions. var _isGeoTriggeringRunning = false; @override void initState() { super.initState(); // Listen to geo triggering event from geo triggering event channel final geoTriggeringEventChannel = MethodChannel(BluedotPointSdk.geoTriggering); geoTriggeringEventChannel.setMethodCallHandler((MethodCall call) async { var args = call.arguments; switch (call.method) { case GeoTriggeringEvents.onZoneInfoUpdate: debugPrint('On Zone Info Update: $args'); break; case GeoTriggeringEvents.didEnterZone: debugPrint('Did Enter Zone: $args'); break; case GeoTriggeringEvents.didExitZone: debugPrint('Did Exit Zone: $args'); break; default: break; } }); } void _startGeoTriggering() { String channelId = 'Your channel Id'; String channelName = 'Your channel Name'; String androidNotificationTitle = 'Your notification title'; String androidNotificationContent = 'Your notification content'; int androidNotificationId = 123; // Will be -1 by default if set to null. BluedotPointSdk.instance.geoTriggeringBuilder() .androidNotification(channelId, channelName, androidNotificationChannel, androidNotificationContent, androidNotificationId) .start().then((value) { //Handle geo triggering started successfully debugPrint('Geo-triggering has been started'); }).catchError((error) { //Handle error when start geo-triggering debugPrint('Failed to start geo-triggering. Error $error'); }); } void _stopGeoTriggering() { BluedotPointSdk.instance.geoTriggeringBuilder().start().then((value) { //Handle geo triggering started successfully debugPrint('Geo-triggering has been started'); }).catchError((error) { //Handle error when start geo-triggering debugPrint('Failed to start geo-triggering. Error $error'); }); } void _updateGeoTriggeringStatus() { BluedotPointSdk.instance.isGeoTriggeringRunning().then((value) { setState(() { _isGeoTriggeringRunning = value; }); }); } @override Widget build(BuildContext context) { return Column( children: [ Text('Is Geo Triggering Running: $_isGeoTriggeringRunning'), ElevatedButton(onPressed: _startGeoTriggering, child: const Text('Start Geo-triggering')), ElevatedButton(onPressed: _stopGeoTriggering, child: const Text('Stop Geo-triggering')), ElevatedButton(onPressed: _updateGeoTriggeringStatus, child: const Text('Update Geo-triggering status')), ], ); } }