AndroidLocationPermissionRequester

Observes and requests foreground location permission on Android.

Android LocationProvider implementations hold a requester and expose it through LocationProvider.permission and LocationProvider.requestPermission.

Call close when the requester is no longer needed. The resolved activity also closes it when destroyed. Construct and use the requester on the main thread.

Constructors

Link copied to clipboard
constructor(context: Context)

Reads permission from context. A context that cannot reach an activity cannot answer the rationale check or launch a request.

Properties

Link copied to clipboard
val status: StateFlow<LocationPermission>

Current foreground location permission.

Functions

Link copied to clipboard
open override fun close()

Removes the activity observer and unregisters any pending permission callback.

Link copied to clipboard

Re-reads the permission status, publishes it to status, and returns it.

Link copied to clipboard

Starts a foreground permission request and returns immediately. The result is published to status.