AdministrativeUnitNameGeocoderRetriever

An implementation of the AdministrativeUnitNameRetriever interface that utilizes the provided Geocoder API to retrieve administrative unit information (e.g., city, state, country) based on geographical coordinates. This class operates asynchronously and emits successfully retrieved information through a returned Flow of AdministrativeUnitName objects.

Retry Mechanism: In case of geocoding failures, this class implements a retry mechanism with a maximum of 3 attempts. This helps mitigate potential transient issues with the geocoding service.

Assumptions: This class assumes the provided GeoLocation object has valid latitude and longitude coordinates.

Constructors

Link copied to clipboard
@Inject
constructor(geocoder: Geocoder)

Functions

Link copied to clipboard
open override fun retrieve(geoLocation: GeoLocation): Flow<AdministrativeUnitName>

Retrieves administrative unit information (e.g., city, state, country) for a given geographical location using the provided Geocoder API. This class operates asynchronously and emits successfully retrieved AdministrativeUnitName objects through the returned Flow of AdministrativeUnitName.