On August 31, 2021, the Places Monitor extension for the Adobe Experience Platform Mobile SDKs was deprecated. Adobe no longer plans to update or support Places Monitor extension beyond August 31st.
flutter_acpplaces_monitor
is a flutter plugin for the iOS and Android AEP Places Monitor SDK to allow for integration with flutter applications. Functionality to enable the PlacesMonitor extension is provided entirely through Dart documented below.
Add flutter_acpcore
, flutter_acppplaces
and flutter_acpplaces_monitor
to your dependencies in pubspec.yaml
dependencies:
flutter_acpcore: ">= 2.0.0"
flutter_acpplaces: ">= 2.0.0"
flutter_acpplaces_monitor: ">= 2.0.0"
Then fetch the packages with:
flutter pub get
Run:
flutter test
import 'package:flutter_acpplaces_monitor/flutter_acpplaces_monitor.dart';
String version = FlutterACPPlacesMonitor.extensionVersion;
Note: It is required to initialize the SDK via native code inside your AppDelegate and MainApplication for iOS and Android respectively. For more information see how to initialize Core.
#import "ACPCore.h"
#import "ACPPlaces.h"
#import "ACPPlacesMonitor.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
[ACPCore configureWithAppId:@"yourAppId"];
[ACPPlaces registerExtension]; //Register Places with Core
[ACPPlacesMonitor registerExtension]; //Register PlacesMonitor with Core
[ACPCore start: nil];
return YES;
}
The following updates are also neccessary for Places Monitor on iOS:
- Enable location updates in the background
- Add the keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription to the app's plist file
Within the App's OnCreate method, register the SDK extensions and start the Places Monitor:
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Places;
import com.adobe.marketing.mobile.PlacesMonitor;
public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
MobileCore.ConfigureWithAppId("yourAppId");
try {
Places.registerExtension(); //Register Places with Core
PlacesMonitor.registerExtension(); //Register PlacesMonitor with Core
MobileCore.start(null);
} catch (Exception e) {
//Log the exception
}
}
}
The following update is also necessary for Places Monitor on Android:
import 'package:flutter_acpplaces_monitor/flutter_acpplaces_monitor.dart';
FlutterACPPlacesMonitor.start();
bool clearPlacesData = true;
FlutterACPPlacesMonitor.stop(clearPlacesData);
FlutterACPPlacesMonitor.updateLocation();
import 'package:flutter_acpplaces_monitor/src/flutter_acpplaces_monitor_location_permission.dart';
FlutterACPPlacesMonitor.setRequestLocationPermission(FlutterACPPlacesMonitorLocationPermission.ALWAYS_ALLOW);
FlutterACPPlacesMonitor.setRequestLocationPermission(FlutterACPPlacesMonitorLocationPermission.WHILE_USING_APP);
FlutterACPPlacesMonitor.setRequestLocationPermission(FlutterACPPlacesMonitorLocationPermission.NONE);
import 'package:flutter_acpplaces_monitor/src/flutter_acpplaces_monitor_modes.dart';
FlutterACPPlacesMonitor.setPlacesMonitorMode(FlutterACPPlacesMonitorModes.CONTINUOUS);
FlutterACPPlacesMonitor.setPlacesMonitorMode(FlutterACPPlacesMonitorModes.SIGNIFICANT_CHANGES);
See CONTRIBUTING
See LICENSE