Edit in GitHubLog an issue

Places API reference

This document contains usage information for the public functions, classes, and enums in AEPPlaces.

clear

Clears out the client-side data for Places in shared state, local storage, and in-memory.

Java

Example

Copied to your clipboard
Places.clear();

Kotlin

Example

Copied to your clipboard
Places.clear()

extensionVersion

Returns the running version of the AEPPlaces extension.

Java

Example

Copied to your clipboard
String placesExtensionVersion = Places.extensionVersion();

Kotlin

Example

Copied to your clipboard
val placesExtensionVersion: String = Places.extensionVersion()

getCurrentPointsOfInterest

Returns all points of interest (POI) of which the device is currently known to be within.

Java

Example

Copied to your clipboard
Places.getCurrentPointsOfInterest(new AdobeCallback<List<PlacesPOI>>() {
@Override
public void call(List<PlacesPOI> pois) {
// use the obtained POIs that the device is within
processUserWithinPois(pois);
}
});

Kotlin

Example

Copied to your clipboard
Places.getCurrentPointsOfInterest() { pois ->
// use the obtained POIs that the device is within
processUserWithinPois(pois)
}

getLastKnownLocation

Returns the last latitude and longitude provided to the AEPPlaces Extension.

If the Places Extension does not have a valid last known location for the user, the parameter passed in the closure will be nil. The CLLocation object returned by this method will only contain a valid coordinate. Other properties on the CLLocation object should not be considered valid.

Java

Example

Copied to your clipboard
Places.getLastKnownLocation(new AdobeCallback<Location>() {
@Override
public void call(Location lastLocation) {
// do something with the last known location
processLastKnownLocation(lastLocation);
}
});

Kotlin

Example

Copied to your clipboard
Places.getLastKnownLocation() { lastLocation ->
// do something with the last known location
processLastKnownLocation(lastLocation)
}

getNearbyPointsOfInterest

Requests a list of nearby Points of Interest (POI) and returns them in a closure.

Java

Syntax

Copied to your clipboard
public static void getNearbyPointsOfInterest(@NonNull final Location location,
final int limit,
@NonNull final AdobeCallback<List<PlacesPOI>> successCallback,
@NonNull final AdobeCallback<PlacesRequestError> errorCallback);

Example

Copied to your clipboard
Places.getNearbyPointsOfInterest(currentLocation, 10,
new AdobeCallback<List<PlacesPOI>>() {
@Override
public void call(List<PlacesPOI> pois) {
// do required processing with the returned nearbyPoi array
startMonitoringPois(pois);
}
}, new AdobeCallback<PlacesRequestError>() {
@Override
public void call(PlacesRequestError placesRequestError) {
// look for the placesRequestError and handle the error accordingly
handleError(placesRequestError);
}
}
);

Kotlin

Example

Copied to your clipboard
Places.getNearbyPointsOfInterest(currentLocation, 10, { pois ->
// do required processing with the returned nearbyPoi array
startMonitoringPois(pois);
}, { error ->
// look for the placesRequestError and handle the error accordingly
handleError(placesRequestError);
})

processGeofence

When a device crosses one of your app's pre-defined Places Service region boundaries, the region and event type are passed to the SDK for processing.

Process a Geofence region event for the provided transitionType.

You can pass the transitionType from GeofencingEvent.getGeofenceTransition(). Currently Geofence.GEOFENCE_TRANSITION_ENTER and Geofence.GEOFENCE_TRANSITION_EXIT are supported.

Java

Syntax

Copied to your clipboard
public static void processGeofence(final Geofence geofence, final int transitionType);

Example

Copied to your clipboard
public class GeofenceTransitionsIntentService extends IntentService {
public GeofenceTransitionsIntentService() {
super("GeofenceTransitionsIntentService");
}
protected void onHandleIntent(Intent intent) {
GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);
List<Geofence> geofences = geofencingEvent.getTriggeringGeofences();
if (geofences.size() > 0) {
// Call the Places API to process information
Places.processGeofence(geofences.get(0), geofencingEvent.getGeofenceTransition());
}
}
}

Kotlin

Example

Copied to your clipboard
fun onHandleIntent(intent: Intent) {
val geofencingEvent = GeofencingEvent.fromIntent(intent)
val geofences = geofencingEvent.getTriggeringGeofences()
if (!geofences.isEmpty()) {
Places.processGeofence(geofences.first(), geofencingEvent.getGeofenceTransition())
}
}

processGeofenceEvent

Process all Geofences in the GeofencingEvent at the same time.

Java

Syntax

Copied to your clipboard
public static void processGeofenceEvent(@NonNull final GeofencingEvent geofencingEvent);

Example

Copied to your clipboard
public class GeofenceTransitionsIntentService extends IntentService {
public GeofenceTransitionsIntentService() {
super("GeofenceTransitionsIntentService");
}
protected void onHandleIntent(Intent intent) {
GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);
// Call the Places API to process information
Places.processGeofenceEvent(geofencingEvent);
}
}

Kotlin

Example

Copied to your clipboard
fun onHandleIntent(intent: Intent) {
val geofencingEvent = GeofencingEvent.fromIntent(intent)
// Call the Places API to process information
Places.processGeofenceEvent(geofencingEvent)
}

processRegionEvent

Passes a CLRegion and a PlacesRegionEvent to be processed by the Places extension.

Calling this method will result in an Event being dispatched to the SDK's EventHub. This enables rule processing based on the triggering region event.

Swift

Syntax

Copied to your clipboard
static func processRegionEvent(_ regionEvent: PlacesRegionEvent,
forRegion region: CLRegion)

Example

Copied to your clipboard
let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: 40.3886845, longitude: -111.8284979),
radius: 100,
identifier: "877677e4-3004-46dd-a8b1-a609bd65a428")
Places.processRegionEvent(.entry, forRegion: region)

Objective-C

Syntax

Copied to your clipboard
+ (void) processRegionEvent: (AEPRegionEventType) eventType
forRegion: (nonnull CLRegion*) region;

Example

Copied to your clipboard
CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:CLLocationCoordinate2DMake(40.3886845, -111.8284979)
radius:100
identifier:@"877677e4-3004-46dd-a8b1-a609bd65a428"];
[AEPMobilePlaces processRegionEvent:AEPPlacesRegionEventEntry forRegion:region];

registerExtension

Java

Example

Copied to your clipboard
Places.registerExtension();

Kotlin

Example

Copied to your clipboard
Places.registerExtension()

setAccuracyAuthorization

Sets the accuracy authorization status in the Places extension.

The value provided is stored in the Places shared state, and is for reference only. Calling this method does not impact the actual location accuracy authorization for this device.

Swift

Syntax

Copied to your clipboard
static func setAccuracyAuthorization(_ accuracy: CLAccuracyAuthorization)

Example

Copied to your clipboard
Places.setAccuracyAuthorization(.fullAccuracy)

Objective-C

Syntax

Copied to your clipboard
+ (void) setAccuracyAuthorization: (CLAccuracyAuthorization) accuracy;

Example

Copied to your clipboard
[AEPMobilePlaces setAccuracyAuthorization:CLAccuracyAuthorizationFullAccuracy];

setAuthorizationStatus

Sets the authorization status in the Places extension.

The status provided is stored in the Places shared state, and is for reference only. Calling this method does not impact the actual location authorization status for this device.

Java

Syntax

Copied to your clipboard
public static void setAuthorizationStatus(final PlacesAuthorizationStatus status);

Example

Copied to your clipboard
Places.setAuthorizationStatus(PlacesAuthorizationStatus.ALWAYS);

Kotlin

Example

Copied to your clipboard
Places.setAuthorizationStatus(PlacesAuthorizationStatus.ALWAYS)

Additional classes and enums

TypeSwiftObjective-C
class
PointOfInterest
AEPPlacesPoi
enum
PlacesQueryResponseCode
AEPlacesQueryResponseCode
enum
PlacesRegionEvent
AEPPlacesRegionEvent

PointOfInterest

NameData Type
identifier
String
latitude
Double
libraryId
String
longitude
Double
metaData
[String: String]
name
String
radius
Int
userIsWithin
Bool
weight
Int

PlacesQueryResponseCode

CaseRaw Value
ok
0
connectivityError
1
serverResponseError
2
invalidLatLongError
3
configurationError
4
queryServiceUnavailable
5
privacyOptedOut
6
unknownError
7

PlacesRegionEvent

CaseRaw Value
entry
0
exit
1
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.