LocationRepository

class LocationRepository(    val context: Context,     defaultLocation: LatLng,     shouldGetPermission: MutableLiveData<Boolean>,     registerListener: (input: LocationUpdateListener) -> Unit)

Repository for location data. This class uses the registerListener in order to aquire the location data.

Constructors

Link copied to clipboard
fun LocationRepository(    context: Context,     defaultLocation: LatLng,     shouldGetPermission: MutableLiveData<Boolean>,     registerListener: (input: LocationUpdateListener) -> Unit)

defaultLocation: the default location to use if no location is available, shouldGetPermission: whether the permission to access the location should be requested, registerListener: a function to register a location listener

Functions

Link copied to clipboard
fun locationCallback(registerListener: (input: LocationUpdateListener) -> Unit)

Register a new location listener.

Link copied to clipboard
fun registerNewListener(registerListener: (input: LocationUpdateListener) -> Unit)

Register a new location listener that only cares about non default values.

Properties

Link copied to clipboard
val context: Context
Link copied to clipboard
val currentPosition: MutableLiveData<LatLng>

The location data. Public interface of the location data.

Link copied to clipboard
var currentPositionIsDefault: Boolean = true

Is the current position recorded unchanged? In that case it is a "fake" location and not recorded from the GPS.