Added in API level 1
Deprecated in API level 34

Criteria

open class Criteria : Parcelable
kotlin.Any
   ↳ android.location.Criteria

A class indicating the application criteria for selecting a location provider. Providers may be ordered according to accuracy, power usage, ability to report altitude, speed, bearing, and monetary cost.

Summary

Constants
static Int

A constant indicating an approximate accuracy requirement

static Int

A constant indicating a finer location accuracy requirement

static Int

a constant indicating a high accuracy requirement - may be used for horizontal, altitude, speed or bearing accuracy.

static Int

A constant indicating a low location accuracy requirement - may be used for horizontal, altitude, speed or bearing accuracy.

static Int

A constant indicating a medium accuracy requirement - currently used only for horizontal accuracy.

static Int

A constant indicating that the application does not choose to place requirement on a particular feature.

static Int

A constant indicating a high power requirement.

static Int

A constant indicating a low power requirement.

static Int

A constant indicating a medium power requirement.

Inherited constants
Public constructors

Constructs a new Criteria object.

Criteria(criteria: Criteria!)

Constructs a new Criteria object that is a copy of the given criteria.

Public methods
open Int

open Int

Returns a constant indicating desired accuracy of location.

open Int

Returns a constant indicating the desired bearing accuracy.

open Int

Returns a constant indicating the desired horizontal accuracy (latitude and longitude).

open Int

Returns a constant indicating the desired maximum power requirement.

open Int

Returns a constant indicating the desired speed accuracy.

open Int

Returns a constant indicating the desired vertical accuracy (altitude).

open Boolean

Returns whether the provider must provide altitude information.

open Boolean

Returns whether the provider must provide bearing information.

open Boolean

Returns whether the provider is allowed to incur monetary cost.

open Boolean

Returns whether the provider must provide speed information.

open Unit
setAccuracy(accuracy: Int)

Indicates the desired accuracy for latitude and longitude.

open Unit
setAltitudeRequired(altitudeRequired: Boolean)

Indicates whether the provider must provide altitude information.

open Unit

Indicates the desired bearing accuracy.

open Unit
setBearingRequired(bearingRequired: Boolean)

Indicates whether the provider must provide bearing information.

open Unit
setCostAllowed(costAllowed: Boolean)

Indicates whether the provider is allowed to incur monetary cost.

open Unit

Indicates the desired horizontal accuracy (latitude and longitude).

open Unit
setPowerRequirement(powerRequirement: Int)

Indicates the desired maximum power requirement.

open Unit
setSpeedAccuracy(accuracy: Int)

Indicates the desired speed accuracy.

open Unit
setSpeedRequired(speedRequired: Boolean)

Indicates whether the provider must provide speed information.

open Unit

Indicates the desired vertical accuracy (altitude).

open String

open Unit
writeToParcel(parcel: Parcel, flags: Int)

Properties
static Parcelable.Creator<Criteria!>

Constants

ACCURACY_COARSE

Added in API level 1
static val ACCURACY_COARSE: Int

Deprecated: Deprecated in Java.

A constant indicating an approximate accuracy requirement

Value: 2

ACCURACY_FINE

Added in API level 1
static val ACCURACY_FINE: Int

Deprecated: Deprecated in Java.

A constant indicating a finer location accuracy requirement

Value: 1

ACCURACY_HIGH

Added in API level 9
Deprecated in API level 34
static val ACCURACY_HIGH: Int

Deprecated: Deprecated in Java.

a constant indicating a high accuracy requirement - may be used for horizontal, altitude, speed or bearing accuracy. For horizontal and vertical position this corresponds roughly to an accuracy of less than 100 meters.

Value: 3

ACCURACY_LOW

Added in API level 9
Deprecated in API level 34
static val ACCURACY_LOW: Int

Deprecated: Deprecated in Java.

A constant indicating a low location accuracy requirement - may be used for horizontal, altitude, speed or bearing accuracy. For horizontal and vertical position this corresponds roughly to an accuracy of greater than 500 meters.

Value: 1

ACCURACY_MEDIUM

Added in API level 9
Deprecated in API level 34
static val ACCURACY_MEDIUM: Int

Deprecated: Deprecated in Java.

A constant indicating a medium accuracy requirement - currently used only for horizontal accuracy. For horizontal position this corresponds roughly to to an accuracy of between 100 and 500 meters.

Value: 2

NO_REQUIREMENT

Added in API level 1
static val NO_REQUIREMENT: Int

Deprecated: Deprecated in Java.

A constant indicating that the application does not choose to place requirement on a particular feature.

Value: 0

POWER_HIGH

Added in API level 1
static val POWER_HIGH: Int

Deprecated: Deprecated in Java.

A constant indicating a high power requirement.

Value: 3

POWER_LOW

Added in API level 1
static val POWER_LOW: Int

Deprecated: Deprecated in Java.

A constant indicating a low power requirement.

Value: 1

POWER_MEDIUM

Added in API level 1
static val POWER_MEDIUM: Int

Deprecated: Deprecated in Java.

A constant indicating a medium power requirement.

Value: 2

Public constructors

Criteria

Added in API level 1
Criteria()

Constructs a new Criteria object. The new object will have no requirements on accuracy, power, or response time; will not require altitude, speed, or bearing; and will not allow monetary cost.

Criteria

Added in API level 1
Criteria(criteria: Criteria!)

Constructs a new Criteria object that is a copy of the given criteria.

Public methods

describeContents

Added in API level 1
open fun describeContents(): Int

Deprecated: Deprecated in Java.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getAccuracy

Added in API level 1
open fun getAccuracy(): Int

Deprecated: Deprecated in Java.

Returns a constant indicating desired accuracy of location.

Return
Int Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_FINE, or android.location.Criteria#ACCURACY_COARSE

getBearingAccuracy

Added in API level 9
Deprecated in API level 34
open fun getBearingAccuracy(): Int

Deprecated: Deprecated in Java.

Returns a constant indicating the desired bearing accuracy.

Return
Int Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH

getHorizontalAccuracy

Added in API level 9
Deprecated in API level 34
open fun getHorizontalAccuracy(): Int

Deprecated: Deprecated in Java.

Returns a constant indicating the desired horizontal accuracy (latitude and longitude).

Return
Int Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH

getPowerRequirement

Added in API level 1
open fun getPowerRequirement(): Int

Deprecated: Deprecated in Java.

Returns a constant indicating the desired maximum power requirement.

Return
Int Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#POWER_LOW, android.location.Criteria#POWER_MEDIUM, or android.location.Criteria#POWER_HIGH

getSpeedAccuracy

Added in API level 9
Deprecated in API level 34
open fun getSpeedAccuracy(): Int

Deprecated: Deprecated in Java.

Returns a constant indicating the desired speed accuracy.

Return
Int Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH

getVerticalAccuracy

Added in API level 9
Deprecated in API level 34
open fun getVerticalAccuracy(): Int

Deprecated: Deprecated in Java.

Returns a constant indicating the desired vertical accuracy (altitude).

Return
Int Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH

isAltitudeRequired

Added in API level 1
open fun isAltitudeRequired(): Boolean

Deprecated: Deprecated in Java.

Returns whether the provider must provide altitude information.

isBearingRequired

Added in API level 1
open fun isBearingRequired(): Boolean

Deprecated: Deprecated in Java.

Returns whether the provider must provide bearing information.

isCostAllowed

Added in API level 1
open fun isCostAllowed(): Boolean

Deprecated: Deprecated in Java.

Returns whether the provider is allowed to incur monetary cost.

isSpeedRequired

Added in API level 1
open fun isSpeedRequired(): Boolean

Deprecated: Deprecated in Java.

Returns whether the provider must provide speed information.

setAccuracy

Added in API level 1
open fun setAccuracy(accuracy: Int): Unit

Deprecated: Deprecated in Java.

Indicates the desired accuracy for latitude and longitude. Accuracy may be ACCURACY_FINE or ACCURACY_COARSE. More accurate location may consume more power and may take longer.

Parameters
accuracy Int: Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_FINE, or android.location.Criteria#ACCURACY_COARSE
Exceptions
java.lang.IllegalArgumentException if accuracy is not one of the supported constants

setAltitudeRequired

Added in API level 1
open fun setAltitudeRequired(altitudeRequired: Boolean): Unit

Deprecated: Deprecated in Java.

Indicates whether the provider must provide altitude information. Not all fixes are guaranteed to contain such information.

setBearingAccuracy

Added in API level 9
Deprecated in API level 34
open fun setBearingAccuracy(accuracy: Int): Unit

Deprecated: Deprecated in Java.

Indicates the desired bearing accuracy. Accuracy may be ACCURACY_LOW, ACCURACY_MEDIUM, ACCURACY_HIGH, or NO_REQUIREMENT. More accurate location may consume more power and may take longer.

Parameters
accuracy Int: Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH
Exceptions
java.lang.IllegalArgumentException if accuracy is not one of the supported constants

setBearingRequired

Added in API level 1
open fun setBearingRequired(bearingRequired: Boolean): Unit

Deprecated: Deprecated in Java.

Indicates whether the provider must provide bearing information. Not all fixes are guaranteed to contain such information.

setCostAllowed

Added in API level 1
open fun setCostAllowed(costAllowed: Boolean): Unit

Deprecated: Deprecated in Java.

Indicates whether the provider is allowed to incur monetary cost.

setHorizontalAccuracy

Added in API level 9
Deprecated in API level 34
open fun setHorizontalAccuracy(accuracy: Int): Unit

Deprecated: Deprecated in Java.

Indicates the desired horizontal accuracy (latitude and longitude). Accuracy may be ACCURACY_LOW, ACCURACY_MEDIUM, ACCURACY_HIGH or NO_REQUIREMENT. More accurate location may consume more power and may take longer.

Parameters
accuracy Int: Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH
Exceptions
java.lang.IllegalArgumentException if accuracy is not one of the supported constants

setPowerRequirement

Added in API level 1
open fun setPowerRequirement(powerRequirement: Int): Unit

Deprecated: Deprecated in Java.

Indicates the desired maximum power requirement. The power requirement parameter may be NO_REQUIREMENT, POWER_LOW, POWER_MEDIUM, or POWER_HIGH.

Parameters
powerRequirement Int: Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#POWER_LOW, android.location.Criteria#POWER_MEDIUM, or android.location.Criteria#POWER_HIGH

setSpeedAccuracy

Added in API level 9
Deprecated in API level 34
open fun setSpeedAccuracy(accuracy: Int): Unit

Deprecated: Deprecated in Java.

Indicates the desired speed accuracy. Accuracy may be ACCURACY_LOW, ACCURACY_MEDIUM, ACCURACY_HIGH, or NO_REQUIREMENT. More accurate location may consume more power and may take longer.

Parameters
accuracy Int: Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH
Exceptions
java.lang.IllegalArgumentException if accuracy is not one of the supported constants

setSpeedRequired

Added in API level 1
open fun setSpeedRequired(speedRequired: Boolean): Unit

Deprecated: Deprecated in Java.

Indicates whether the provider must provide speed information. Not all fixes are guaranteed to contain such information.

setVerticalAccuracy

Added in API level 9
Deprecated in API level 34
open fun setVerticalAccuracy(accuracy: Int): Unit

Deprecated: Deprecated in Java.

Indicates the desired vertical accuracy (altitude). Accuracy may be ACCURACY_LOW, ACCURACY_MEDIUM, ACCURACY_HIGH or NO_REQUIREMENT. More accurate location may consume more power and may take longer.

Parameters
accuracy Int: Value is android.location.Criteria#NO_REQUIREMENT, android.location.Criteria#ACCURACY_LOW, android.location.Criteria#ACCURACY_MEDIUM, or android.location.Criteria#ACCURACY_HIGH
Exceptions
java.lang.IllegalArgumentException if accuracy is not one of the supported constants

toString

Added in API level 1
open fun toString(): String

Deprecated: Deprecated in Java.

Return
String a string representation of the object.

writeToParcel

Added in API level 1
open fun writeToParcel(
    parcel: Parcel,
    flags: Int
): Unit

Deprecated: Deprecated in Java.

Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 1
static val CREATOR: Parcelable.Creator<Criteria!>

Deprecated: Deprecated in Java.