BaseLocationManager

abstract class BaseLocationManager(settings: BaseLocationManager.Settings, coroutineScope: CoroutineScope) : LocationManager, CoroutineScope

An abstract implementation for LocationManager

Parameters

settings

the Settings to configure this location manager

coroutineScope

the CoroutineScope this location manager runs on

Inheritors

Constructors

Link copied to clipboard
constructor(settings: BaseLocationManager.Settings, coroutineScope: CoroutineScope)

Types

Link copied to clipboard
interface Builder

Builder for creating a BaseLocationManager

Link copied to clipboard
object Companion
Link copied to clipboard
data class Settings(val locationPermission: LocationPermission, val permissions: Permissions, val autoRequestPermission: Boolean = true, val autoEnableLocations: Boolean = true, val locationBufferCapacity: Int = 16, val minUpdateDistanceMeters: Float = 0.0f, val logger: Logger = RestrictedLogger(RestrictedLogLevel.None))

Settings to configure a BaseLocationManager

Properties

Link copied to clipboard
Link copied to clipboard
open override val events: Flow<LocationManager.Event>

A Flow of all the Event detected by the location manager

Link copied to clipboard

The LocationPermission used for managing this location. If LocationPermission.precise this will scan location at high accuracy If LocationPermission.background this will monitor location from the background

Link copied to clipboard
open override val locations: Flow<Location.KnownLocation>

A Flow of the Location.KnownLocation detected by the location manager

Functions

Link copied to clipboard
open override fun isLocationEnabled(): Boolean

If true the location service is currently enabled

Link copied to clipboard
abstract suspend fun requestEnableLocation()

Attempts to request the user to enable the location service

Link copied to clipboard
abstract suspend fun startMonitoringLocation()

Starts monitoring for new Location.KnownLocation that will be emitted on the locations flow

Link copied to clipboard
open suspend override fun startMonitoringLocationEnabled()

Starts monitoring for changes related to the location service being enabled This will result in Event.LocationEnabled and Event.LocationDisabled on the events flow

Link copied to clipboard
open suspend override fun startMonitoringPermissions()

Starts monitoring for changes to permissions related to locationPermission This will result in Event.PermissionChanged on the events flow

Link copied to clipboard
abstract suspend fun stopMonitoringLocation()

Stops monitoring for new Location.KnownLocation

Link copied to clipboard
open suspend override fun stopMonitoringLocationEnabled()

Stops monitoring for changes related to the location service being enabled

Link copied to clipboard
open suspend override fun stopMonitoringPermissions()

Stops monitoring for changes to permissions related to locationPermission