Java
Example
Copied to your clipboardPlaces.clear();
Kotlin
Example
Copied to your clipboardPlaces.clear()
Swift
Syntax
Copied to your clipboardstatic func clear()
Example
Copied to your clipboardPlaces.clear()
Objective-C
Syntax
Copied to your clipboard+ (void) clear;
Example
Copied to your clipboard[AEPMobilePlaces clear];
Java
Example
Copied to your clipboardString placesExtensionVersion = Places.extensionVersion();
Kotlin
Example
Copied to your clipboardval placesExtensionVersion: String = Places.extensionVersion()
Swift
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet placesVersion = Places.extensionVersion
Objective-C
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Copied to your clipboardNSString *placesVersion = [AEPMobilePlaces extensionVersion];
Java
Example
Copied to your clipboardPlaces.getCurrentPointsOfInterest(new AdobeCallback<List<PlacesPOI>>() {@Overridepublic void call(List<PlacesPOI> pois) {// use the obtained POIs that the device is withinprocessUserWithinPois(pois);}});
Kotlin
Example
Copied to your clipboardPlaces.getCurrentPointsOfInterest() { pois ->// use the obtained POIs that the device is withinprocessUserWithinPois(pois)}
Swift
Syntax
Copied to your clipboardstatic func getCurrentPointsOfInterest(_ closure: @escaping ([PointOfInterest]) -> Void)
Example
Copied to your clipboardPlaces.getCurrentPointsOfInterest() { currentPois inprint("currentPois: (currentPois)")}
Objective-C
Syntax
Copied to your clipboard+ (void) getCurrentPointsOfInterest: ^(NSArray<AEPPlacesPoi*>* _Nonnull pois) closure;
Example
Copied to your clipboard[AEPMobilePlaces getCurrentPointsOfInterest:^(NSArray<AEPPlacesPoi *> *pois) {NSLog(@"currentPois: %@", pois);}];
Java
Example
Copied to your clipboardPlaces.getLastKnownLocation(new AdobeCallback<Location>() {@Overridepublic void call(Location lastLocation) {// do something with the last known locationprocessLastKnownLocation(lastLocation);}});
Kotlin
Example
Copied to your clipboardPlaces.getLastKnownLocation() { lastLocation ->// do something with the last known locationprocessLastKnownLocation(lastLocation)}
Swift
Syntax
Copied to your clipboardstatic func getLastKnownLocation(_ closure: @escaping (CLLocation?) -> Void)
Example
Copied to your clipboardPlaces.getLastKnownLocation() { location inif let location = location {print("location returned from closure: ((location.coordinate.latitude), (location.coordinate.longitude))")}}
Objective-C
Syntax
Copied to your clipboard+ (void) getLastKnownLocation: ^(CLLocation* _Nullable lastLocation) closure;
Example
Copied to your clipboard[AEPMobilePlaces getLastKnownLocation:^(CLLocation *location) {if (location) {NSLog(@"location returned from closure: (%f, %f)", location.coordinate.latitude, location.coordinate.longitude);}}];
Java
Syntax
Copied to your clipboardpublic 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 clipboardPlaces.getNearbyPointsOfInterest(currentLocation, 10,new AdobeCallback<List<PlacesPOI>>() {@Overridepublic void call(List<PlacesPOI> pois) {// do required processing with the returned nearbyPoi arraystartMonitoringPois(pois);}}, new AdobeCallback<PlacesRequestError>() {@Overridepublic void call(PlacesRequestError placesRequestError) {// look for the placesRequestError and handle the error accordinglyhandleError(placesRequestError);}});
Kotlin
Example
Copied to your clipboardPlaces.getNearbyPointsOfInterest(currentLocation, 10, { pois ->// do required processing with the returned nearbyPoi arraystartMonitoringPois(pois);}, { error ->// look for the placesRequestError and handle the error accordinglyhandleError(placesRequestError);})
Swift
Syntax
Copied to your clipboardstatic func getNearbyPointsOfInterest(forLocation location: CLLocation,withLimit limit: UInt,closure: @escaping ([PointOfInterest], PlacesQueryResponseCode) -> Void)
Example
Copied to your clipboardlet location = CLLocation(latitude: 40.4350229, longitude: -111.8918356)Places.getNearbyPointsOfInterest(forLocation: location, withLimit: 10) { (nearbyPois, responseCode) inprint("responseCode: (responseCode.rawValue) - nearbyPois: (nearbyPois)")}
Objective-C
Syntax
Copied to your clipboard+ (void) getNearbyPointsOfInterest: (nonnull CLLocation*) currentLocationlimit: (NSUInteger) limitcallback: ^ (NSArray<AEPPlacesPoi*>* _Nonnull, AEPPlacesQueryResponseCode) closure;
Example
Copied to your clipboardCLLocation *location = [[CLLocation alloc] initWithLatitude:40.4350229 longitude:-111.8918356];[AEPMobilePlaces getNearbyPointsOfInterest:locationlimit:10callback:^(NSArray<AEPPlacesPoi *> *pois, AEPPlacesQueryResponseCode responseCode) {NSLog(@"responseCode: %ld", (long)responseCode);NSLog(@"nearbyPois: %@", pois);}];
Java
Syntax
Copied to your clipboardpublic static void processGeofence(final Geofence geofence, final int transitionType);
Example
Copied to your clipboardpublic 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 informationPlaces.processGeofence(geofences.get(0), geofencingEvent.getGeofenceTransition());}}}
Kotlin
Example
Copied to your clipboardfun onHandleIntent(intent: Intent) {val geofencingEvent = GeofencingEvent.fromIntent(intent)val geofences = geofencingEvent.getTriggeringGeofences()if (!geofences.isEmpty()) {Places.processGeofence(geofences.first(), geofencingEvent.getGeofenceTransition())}}
Java
Syntax
Copied to your clipboardpublic static void processGeofenceEvent(@NonNull final GeofencingEvent geofencingEvent);
Example
Copied to your clipboardpublic class GeofenceTransitionsIntentService extends IntentService {public GeofenceTransitionsIntentService() {super("GeofenceTransitionsIntentService");}protected void onHandleIntent(Intent intent) {GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);// Call the Places API to process informationPlaces.processGeofenceEvent(geofencingEvent);}}
Kotlin
Example
Copied to your clipboardfun onHandleIntent(intent: Intent) {val geofencingEvent = GeofencingEvent.fromIntent(intent)// Call the Places API to process informationPlaces.processGeofenceEvent(geofencingEvent)}
Swift
Syntax
Copied to your clipboardstatic func processRegionEvent(_ regionEvent: PlacesRegionEvent,forRegion region: CLRegion)
Example
Copied to your clipboardlet 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) eventTypeforRegion: (nonnull CLRegion*) region;
Example
Copied to your clipboardCLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:CLLocationCoordinate2DMake(40.3886845, -111.8284979)radius:100identifier:@"877677e4-3004-46dd-a8b1-a609bd65a428"];[AEPMobilePlaces processRegionEvent:AEPPlacesRegionEventEntry forRegion:region];
Java
Example
Copied to your clipboardPlaces.registerExtension();
Kotlin
Example
Copied to your clipboardPlaces.registerExtension()
Swift
Example
Copied to your clipboardMobileCore.registerExtensions([Places.self])
Objective-C
Example
Copied to your clipboard[AEPMobileCore registerExtensions:@[AEPMobilePlaces.class] completion:nil];
Swift
Syntax
Copied to your clipboardstatic func setAccuracyAuthorization(_ accuracy: CLAccuracyAuthorization)
Example
Copied to your clipboardPlaces.setAccuracyAuthorization(.fullAccuracy)
Objective-C
Syntax
Copied to your clipboard+ (void) setAccuracyAuthorization: (CLAccuracyAuthorization) accuracy;
Example
Copied to your clipboard[AEPMobilePlaces setAccuracyAuthorization:CLAccuracyAuthorizationFullAccuracy];
Java
Syntax
Copied to your clipboardpublic static void setAuthorizationStatus(final PlacesAuthorizationStatus status);
Example
Copied to your clipboardPlaces.setAuthorizationStatus(PlacesAuthorizationStatus.ALWAYS);
Kotlin
Example
Copied to your clipboardPlaces.setAuthorizationStatus(PlacesAuthorizationStatus.ALWAYS)
Swift
Syntax
Copied to your clipboardstatic func setAuthorizationStatus(status: CLAuthorizationStatus)
Example
Copied to your clipboard// in the class implementing CLLocationManagerDelegate:func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {Places.setAuthorizationStatus(status: manager.authorizationStatus)}
Objective-C
Syntax
Copied to your clipboard+ (void) setAuthorizationStatus: (CLAuthorizationStatus) status;
Example
Copied to your clipboard// in the class implementing CLLocationManagerDelegate:- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager {[AEPMobilePlaces setAuthorizationStatus:manager.authorizationStatus];}