batchEvaluateGeofences method
Evaluates device positions against the geofence geometries from a given geofence collection.
This operation always returns an empty response because geofences are asynchronously evaluated. The evaluation determines if the device has entered or exited a geofenced area, and then publishes one of the following events to Amazon EventBridge:
-
ENTERif Amazon Location determines that the tracked device has entered a geofenced area. -
EXITif Amazon Location determines that the tracked device has exited a geofenced area.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter collectionName :
The geofence collection used in evaluating the position of devices against
its geofences.
Parameter devicePositionUpdates :
Contains device details for each device to be evaluated against the given
geofence collection.
Implementation
Future<BatchEvaluateGeofencesResponse> batchEvaluateGeofences({
required String collectionName,
required List<DevicePositionUpdate> devicePositionUpdates,
}) async {
final $payload = <String, dynamic>{
'DevicePositionUpdates': devicePositionUpdates,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/geofencing/v0/collections/${Uri.encodeComponent(collectionName)}/positions',
exceptionFnMap: _exceptionFns,
);
return BatchEvaluateGeofencesResponse.fromJson(response);
}