Skip to content

Commit

Permalink
Add documentation for LocationProvider interface
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedol committed Aug 18, 2024
1 parent b983bbb commit 4f5bb19
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,33 @@ package com.addhen.klocation

import kotlinx.coroutines.flow.Flow

/**
* [LocationProvider] defines the contract for platform-specific location provider implementations.
*
* Implementations of this interface are typically not used directly by application code.
* Instead, they are utilized by the [LocationService] to provide location functionality.
*/
public interface LocationProvider {

/**
* Requests continuous location updates.
*
* @return A [Flow] of [LocationState] representing the stream of location updates.
* The flow will emit new states as the device's location changes or if there are any errors.
*/
public fun requestLocationUpdates(): Flow<LocationState>

/**
* Retrieves the last known location.
*
* @return A [LocationState] representing the last known location or an error state.
*/
public suspend fun getLastKnownLocation(): LocationState

/**
* Stops requesting location updates.
*
* Call this method to stop receiving location updates when they are no longer needed.
*/
public fun stopRequestingLocationUpdates()
}

0 comments on commit 4f5bb19

Please sign in to comment.