public class

LocationRequestOptions

extends Object
implements Parcelable JsonSerializable
java.lang.Object
   ↳ com.urbanairship.location.LocationRequestOptions

Class Overview

High level location requirements to be used for UALocationManager and service.

The class is modeled after the LocationRequest for the Fused Location Provider, but only supports a subset of the options.

Summary

Nested Classes
class LocationRequestOptions.Builder Builder to construct LocationRequestOptions. 
@interface LocationRequestOptions.Priority  
Constants
int DEFAULT_REQUEST_PRIORITY Default priority - PRIORITY_BALANCED_POWER_ACCURACY.
float DEFAULT_UPDATE_INTERVAL_METERS Default minDistance in meters - 800 meters.
long DEFAULT_UPDATE_INTERVAL_MILLISECONDS Default minTime in milliseconds - 5 mins.
String MIN_DISTANCE_KEY JSON key for the min distance.
String MIN_TIME_KEY JSON key for the min time.
int PRIORITY_BALANCED_POWER_ACCURACY Used with setPriority(int) to request balanced power and accuracy.
int PRIORITY_HIGH_ACCURACY Used with setPriority(int) to request highest level of accuracy.
String PRIORITY_KEY JSON key for the request priority.
int PRIORITY_LOW_POWER Used with setPriority(int) to request low power location updates.
int PRIORITY_NO_POWER Used with setPriority(int) to request location that requires no extra power consumption.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<LocationRequestOptions> CREATOR
Public Methods
static LocationRequestOptions createDefaultOptions()
int describeContents()
boolean equals(Object o)
float getMinDistance()
The minimum distance of meters between location updates.
long getMinTime()
The minimum time in milliseconds between location updates in milliseconds.
int getPriority()
The priority of the request.
static LocationRequestOptions parseJson(String json)
Creates a LocationRequestOptions from a JSON string.
JsonValue toJsonValue()
Returns the objects represented as a JsonValue.
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable
From interface com.urbanairship.json.JsonSerializable

Constants

public static final int DEFAULT_REQUEST_PRIORITY

Default priority - PRIORITY_BALANCED_POWER_ACCURACY.

Constant Value: 2 (0x00000002)

public static final float DEFAULT_UPDATE_INTERVAL_METERS

Default minDistance in meters - 800 meters.

Constant Value: 800.0

public static final long DEFAULT_UPDATE_INTERVAL_MILLISECONDS

Default minTime in milliseconds - 5 mins.

Constant Value: 300000 (0x00000000000493e0)

public static final String MIN_DISTANCE_KEY

JSON key for the min distance.

Constant Value: "minDistance"

public static final String MIN_TIME_KEY

JSON key for the min time.

Constant Value: "minTime"

public static final int PRIORITY_BALANCED_POWER_ACCURACY

Used with setPriority(int) to request balanced power and accuracy.

When used with the fused location provider it will use "block" level accuracy, about 100 meter accuracy.

When used with standard android location it will use Criteria.ACCURACY_COARSE and Criteria.POWER_MEDIUM.

Constant Value: 2 (0x00000002)

public static final int PRIORITY_HIGH_ACCURACY

Used with setPriority(int) to request highest level of accuracy.

When used with the fused location provider it will request the highest level of accuracy available.

When used with standard android location it will use Criteria.ACCURACY_FINE and Criteria.POWER_HIGH.

Constant Value: 1 (0x00000001)

public static final String PRIORITY_KEY

JSON key for the request priority.

Constant Value: "priority"

public static final int PRIORITY_LOW_POWER

Used with setPriority(int) to request low power location updates.

When used with the fused location provider it will use "city" level accuracy, about 10km accuracy.

When used with standard android location it will use Criteria.ACCURACY_COARSE and Criteria.POWER_LOW.

Constant Value: 3 (0x00000003)

public static final int PRIORITY_NO_POWER

Used with setPriority(int) to request location that requires no extra power consumption.

Warning: When used with the standard android location it will only use the PASSIVE provider if available. The passive provider requires ACCESS_FINE_LOCATION permission. If either the provider is missing or missing permissions location will not be gathered.

Constant Value: 4 (0x00000004)

Fields

public static final Creator<LocationRequestOptions> CREATOR

Public Methods

public static LocationRequestOptions createDefaultOptions ()

Returns
  • Default location request options.

public int describeContents ()

public boolean equals (Object o)

public float getMinDistance ()

The minimum distance of meters between location updates.

Returns
  • The minimum distance of meters between location updates.

public long getMinTime ()

The minimum time in milliseconds between location updates in milliseconds.

Returns
  • The desired interval for location updates in milliseconds.

public int getPriority ()

The priority of the request.

Returns
  • The priority of the request.

public static LocationRequestOptions parseJson (String json)

Creates a LocationRequestOptions from a JSON string.

Parameters
json The JSON string.
Returns
  • A LocationRequestOptions, or null if the JSON is not a valid object.
Throws
JsonException If the string is unable to be parsed to a JsonValue.

public JsonValue toJsonValue ()

Returns the objects represented as a JsonValue.

Returns
  • The object as a JsonValue.

public String toString ()

public void writeToParcel (Parcel dest, int flags)