LocationManagerCompat

Helper for accessing features in LocationManager.

Functions

Link copied to clipboard
@RequiresPermission(anyOf = [])
open fun getCurrentLocation(@NonNull locationManager: @NonNull LocationManager, @NonNull provider: @NonNull String, @Nullable cancellationSignal: @Nullable CancellationSignal, @NonNull executor: @NonNull Executor, @NonNull consumer: @NonNull Consumer<Location>)
@RequiresPermission(anyOf = [])
open fun getCurrentLocation(@NonNull locationManager: @NonNull LocationManager, @NonNull provider: @NonNull String, cancellationSignal: @Nullable CancellationSignal, @NonNull executor: @NonNull Executor, @NonNull consumer: @NonNull Consumer<Location>)
Asynchronously returns a single current location fix from the given provider.
Link copied to clipboard
@Nullable
open fun getGnssHardwareModelName(@NonNull locationManager: @NonNull LocationManager): @Nullable String
Returns the model name (including vendor and hardware/software version) of the GNSS hardware driver, or null if this information is not available.
Link copied to clipboard
open fun getGnssYearOfHardware(@NonNull locationManager: @NonNull LocationManager): Int
Returns the model year of the GNSS hardware and software build, or 0 if the model year is before 2016.
Link copied to clipboard
open fun hasProvider(@NonNull locationManager: @NonNull LocationManager, @NonNull provider: @NonNull String): Boolean
Returns true if the given location provider exists on this device, irrespective of whether it is currently enabled or not.
Link copied to clipboard
open fun isLocationEnabled(@NonNull locationManager: @NonNull LocationManager): Boolean
Returns the current enabled/disabled state of location.
Link copied to clipboard
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
open fun registerGnssMeasurementsCallback(@NonNull locationManager: @NonNull LocationManager, callback: @NonNull GnssMeasurementsEvent.Callback, @NonNull handler: @NonNull Handler): Boolean
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
open fun registerGnssMeasurementsCallback(@NonNull locationManager: @NonNull LocationManager, @NonNull executor: @NonNull Executor, callback: @NonNull GnssMeasurementsEvent.Callback): Boolean
Registers a GNSS measurement callback.
Link copied to clipboard
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
open fun registerGnssStatusCallback(@NonNull locationManager: @NonNull LocationManager, callback: @NonNull GnssStatusCompat.Callback, @NonNull handler: @NonNull Handler): Boolean
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
open fun registerGnssStatusCallback(@NonNull locationManager: @NonNull LocationManager, @NonNull executor: @NonNull Executor, callback: @NonNull GnssStatusCompat.Callback): Boolean
Registers a platform agnostic GnssStatusCompat.Callback.
Link copied to clipboard
@RequiresPermission(anyOf = [])
open fun removeUpdates(@NonNull locationManager: @NonNull LocationManager, @NonNull listener: @NonNull LocationListenerCompat)
Removes all location updates for the specified LocationListener.
Link copied to clipboard
@RequiresPermission(anyOf = [])
open fun requestLocationUpdates(@NonNull locationManager: @NonNull LocationManager, @NonNull provider: @NonNull String, @NonNull locationRequest: @NonNull LocationRequestCompat, @NonNull listener: @NonNull LocationListenerCompat, @NonNull looper: @NonNull Looper)
Register for location updates from the specified provider, using a LocationRequestCompat, and a callback on the specified Looper.
@RequiresPermission(anyOf = [])
open fun requestLocationUpdates(@NonNull locationManager: @NonNull LocationManager, @NonNull provider: @NonNull String, @NonNull locationRequest: @NonNull LocationRequestCompat, @NonNull executor: @NonNull Executor, @NonNull listener: @NonNull LocationListenerCompat)
Register for location updates from the specified provider, using a LocationRequestCompat, and a callback on the specified Executor.
Link copied to clipboard
open fun unregisterGnssMeasurementsCallback(@NonNull locationManager: @NonNull LocationManager, callback: @NonNull GnssMeasurementsEvent.Callback)
Unregisters a GNSS measurement callback.
Link copied to clipboard
open fun unregisterGnssStatusCallback(@NonNull locationManager: @NonNull LocationManager, callback: @NonNull GnssStatusCompat.Callback)
Unregisters a platform agnostic GnssStatusCompat.Callback.