LocationCompat

Helper for accessing features in android.location.Location.

Properties

Link copied to clipboard
val EXTRA_BEARING_ACCURACY: String = "bearingAccuracy"
Constant used as a key to store bearing accuracy in getExtras for Android SDK levels below Oreo (26).
Link copied to clipboard
val EXTRA_IS_MOCK: String = "mockLocation"
Constant used as a key to store mock location status in getExtras for Android SDK levels below JBMR2 (18).
Link copied to clipboard
val EXTRA_MSL_ALTITUDE: String = "androidx.core.location.extra.MSL_ALTITUDE"
Constant used as a key to store Mean Sea Level altitude in getExtras.
Link copied to clipboard
val EXTRA_MSL_ALTITUDE_ACCURACY: String = "androidx.core.location.extra.MSL_ALTITUDE_ACCURACY"
Constant used as a key to store Mean Sea Level altitude in getExtras.
Link copied to clipboard
val EXTRA_SPEED_ACCURACY: String = "speedAccuracy"
Constant used as a key to store speed accuracy in getExtras for Android SDK levels below Oreo (26).
Link copied to clipboard
val EXTRA_VERTICAL_ACCURACY: String = "verticalAccuracy"
Constant used as a key to store vertical accuracy in getExtras for Android SDK levels below Oreo (26).

Functions

Link copied to clipboard
open fun getBearingAccuracyDegrees(@NonNull location: @NonNull Location): Float
Get the estimated bearing accuracy of this location in degrees.
Link copied to clipboard
open fun getElapsedRealtimeMillis(@NonNull location: @NonNull Location): Long
Return the time of this fix, in milliseconds of elapsed real-time since system boot.
Link copied to clipboard
open fun getElapsedRealtimeNanos(@NonNull location: @NonNull Location): Long
Return the time of this fix, in nanoseconds of elapsed real-time since system boot.
Link copied to clipboard
@FloatRange(from = 0.0)
open fun getMslAltitudeAccuracyMeters(@NonNull location: @NonNull Location): Float
Returns the estimated Mean Sea Level altitude accuracy in meters of the location at the 68th percentile confidence level.
Link copied to clipboard
open fun getMslAltitudeMeters(@NonNull location: @NonNull Location): Double
Returns the Mean Sea Level altitude of the location in meters.
Link copied to clipboard
open fun getSpeedAccuracyMetersPerSecond(@NonNull location: @NonNull Location): Float
Get the estimated speed accuracy of this location in meters per second.
Link copied to clipboard
open fun getVerticalAccuracyMeters(@NonNull location: @NonNull Location): Float
Get the estimated vertical accuracy of this location in meters.
Link copied to clipboard
open fun hasBearingAccuracy(@NonNull location: @NonNull Location): Boolean
Returns true if this location has a bearing accuracy.
Link copied to clipboard
open fun hasMslAltitude(@NonNull location: @NonNull Location): Boolean
Returns true if the location has a Mean Sea Level altitude, false otherwise.
Link copied to clipboard
open fun hasMslAltitudeAccuracy(@NonNull location: @NonNull Location): Boolean
Returns true if the location has a Mean Sea Level altitude accuracy, false otherwise.
Link copied to clipboard
open fun hasSpeedAccuracy(@NonNull location: @NonNull Location): Boolean
Returns true if this location has a speed accuracy.
Link copied to clipboard
open fun hasVerticalAccuracy(@NonNull location: @NonNull Location): Boolean
Returns true if this location has a vertical accuracy.
Link copied to clipboard
open fun isMock(@NonNull location: @NonNull Location): Boolean
Returns true if this location is marked as a mock location.
Link copied to clipboard
open fun removeBearingAccuracy(@NonNull location: @NonNull Location)
Removes the bearing accuracy from the location.
Link copied to clipboard
open fun removeMslAltitude(@NonNull location: @NonNull Location)
Removes the Mean Sea Level altitude from the location.
Link copied to clipboard
open fun removeMslAltitudeAccuracy(@NonNull location: @NonNull Location)
Removes the Mean Sea Level altitude accuracy from the location.
Link copied to clipboard
open fun removeSpeedAccuracy(@NonNull location: @NonNull Location)
Removes the speed accuracy from the location.
Link copied to clipboard
open fun removeVerticalAccuracy(@NonNull location: @NonNull Location)
Removes the vertical accuracy from the location.
Link copied to clipboard
open fun setBearingAccuracyDegrees(@NonNull location: @NonNull Location, bearingAccuracyD: Float)
Set the estimated bearing accuracy of this location in degrees.
Link copied to clipboard
open fun setMock(@NonNull location: @NonNull Location, mock: Boolean)
Sets whether this location is marked as a mock location.
Link copied to clipboard
open fun setMslAltitudeAccuracyMeters(@NonNull location: @NonNull Location, @FloatRange(from = 0.0) mslAltitudeAccuracyMeters: Float)
Sets the Mean Sea Level altitude accuracy of the location in meters.
Link copied to clipboard
open fun setMslAltitudeMeters(@NonNull location: @NonNull Location, mslAltitudeMeters: Double)
Sets the Mean Sea Level altitude of the location in meters.
Link copied to clipboard
open fun setSpeedAccuracyMetersPerSecond(@NonNull location: @NonNull Location, speedAccuracyMps: Float)
Set the estimated speed accuracy of this location in meters per second.
Link copied to clipboard
open fun setVerticalAccuracyMeters(@NonNull location: @NonNull Location, verticalAccuracyM: Float)
Set the estimated vertical accuracy of this location in meters.