AndroidLocationBackend

An Android location implementation discovered through ServiceLoader.

An installed and available backend supplies the providers that createDefaultLocationProvider and createDefaultHeadingProvider create; the framework providers remain the default otherwise. When several backends are available, the highest priority wins, and equal priorities resolve to the first id in lexicographic order. A ServiceConfigurationError, a LinkageError, or an exception while loading or checking a backend maps LocationProvider.backendAvailability to LocationBackendAvailability.Misconfigured. The installed backend documents its own availability conditions.

Properties

Link copied to clipboard
abstract val id: String

A stable name used in diagnostics and to break priority ties.

Link copied to clipboard
open val priority: Int

The precedence of this backend when several are available. The backend with the highest priority supplies the default providers. Backends ship with priority 0; declare a higher value for a backend that is a better fit on its own hardware, or a negative value for a last resort.

Functions

Link copied to clipboard

Creates this backend's heading provider.

Link copied to clipboard

Creates this backend's location provider.

Link copied to clipboard
abstract fun isAvailable(context: Context): Boolean

Whether this backend can run on the current device.