AndroidLocationNameResolver

Android LocationNameResolver backed by the platform Geocoder (reverse geocoding).

Branching:

  • API 33+ (Tiramisu): the async Geocoder.getFromLocation with a GeocodeListener, bridged to a suspend point via suspendCancellableCoroutine. The blocking overload is deprecated there.

  • Below 33: the blocking overload on Dispatchers.IO.

Every failure path — no geocoder backend (Geocoder.isPresent false), no result, or any exception — resolves to a coords-only PlaceName so the caller always has a label to show. The resolver itself never throws.

A device geocoder needs network to resolve; an app running fully offline should bind its own deterministic/offline LocationNameResolver instead — this implementation is the production path for a connected device.

Constructors

Link copied to clipboard
constructor(context: Context)

Functions

Link copied to clipboard
open suspend override fun resolve(latitude: Double, longitude: Double): PlaceName

Resolve latitude/longitude to a PlaceName; suspends, never throws.