flutter_acpplaces
flutter_acpplaces
is a flutter plugin for the iOS and Android AEP Places SDK to allow for integration with flutter applications. Functionality to enable the Places extension is provided entirely through Dart documented below.
Installation
Install instructions for this package can be found here.
Note: After you have installed the SDK, don't forget to run
pod install
in yourios
directory to link the libraries to your Xcode project.
Tests
Run:
flutter test
Usage
Places
Importing the SDK:
import 'package:flutter_acpplaces/flutter_acpplaces.dart';
Getting the SDK version:
String version = await FlutterACPPlaces.extensionVersion;
Registering the extension with ACPCore:
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.
iOS
Swift
import ACPPlaces
ACPPlaces.registerExtension()
Objective-C
#import "ACPPlaces.h"
[ACPPlaces registerExtension];
Android:
import com.adobe.marketing.mobile.Places;
Places.registerExtension();
Clear client side Places plugin data:
try {
await FlutterACPPlaces.clear;
} on PlatformException {
log("Failed to clear Places data.");
}
Get the current POI's that the device is currently known to be within:
String pois;
try {
pois = await FlutterACPPlaces.currentPointsOfInterest;
} on PlatformException {
log("Failed to get the current POI's.");
}
Get the last latitude and longitude stored in the Places plugin:
String location;
try {
location = await FlutterACPPlaces.lastKnownLocation;
} on PlatformException {
log("Failed to get the last known location.");
}
Get a list of nearby POI's:
String pois;
try {
var location = {'latitude':37.3309422, 'longitude': -121.8939077};
pois = await FlutterACPPlaces.getNearbyPointsOfInterest(location, 100);
} on PlatformException {
log("Failed to get the nearby POI's.");
}
Pass a Geofence and transition type to be processed by the Places plugin:
var geofence = new Geofence({'requestId':'d4e72ade-0400-4280-9bfe-8ba7553a6444', 'latitude':37.3309422, 'longitude': -121.8939077, 'radius': 1000, 'expirationDuration':-1});
FlutterACPPlaces.processGeofence(geofence, ACPPlacesRegionEventType.ENTRY);
Set the authorization status:
FlutterACPPlaces.setAuthorizationStatus(ACPPlacesAuthorizationStatus.ALWAYS);
Contributing
See CONTRIBUTING
License
See LICENSE