public final class IALocationRequest
extends java.lang.Object
implements android.os.Parcelable
Provides quality of service attributes to the IALocationManager
. All values are optional,
to use default values pass IALocationRequest
returned from create()
Similarly to Android's LocationRequest API, IALocationRequest can be used to set
fastest interval
which controls the
frequency of the received locations timewise.
Smallest displacement
can be used
to control the frequency with respect to displacement or change in the coordinates. If both
the fastest interval
and smallest discplacement
are used together, both
conditions are checked before the location is outputted to the application.
Priority
of the IALocationRequest controls the
mode of positioning and it emulates the Android's LocationRequest API as well. We can
either request low power
positions which enables efficient low-cost background usage
of IndoorAtlas positioning, or we can request high accuracy
updates when user needs
very accurate locations.
Priority
of the positioning can be controlled runtime by requesting different
priority positions in conjuction:
A. Request low power positions by using setPriority(int)
with PRIORITY_LOW_POWER
. (see
requesting location updates
)
B. Request high accuracy positions by using setPriority(int)
with PRIORITY_HIGH_ACCURACY
.
C. Remove high accuracy positions in B (see
removing location
updates
).
Battery consumption can be efficiently controlled by using
setPriority(int)
with
setFastestInterval(long)
. For example using an update interval of
15 seconds or more, leads to positioning consuming significantly less battery power.
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<IALocationRequest> |
CREATOR |
static int |
PRIORITY_HIGH_ACCURACY
Constant indicating high accuracy positioning mode
|
static int |
PRIORITY_LOW_POWER
Constant indicating low power positioning mode
|
Modifier and Type | Method and Description |
---|---|
static IALocationRequest |
create() |
int |
describeContents() |
boolean |
equals(java.lang.Object o) |
long |
getFastestInterval()
Get fastest interval of this request, in milliseconds.
|
<T extends android.os.Parcelable> |
getParcelableExtra(java.lang.String key) |
int |
getPriority()
Return the priority of this request
|
float |
getSmallestDisplacement()
Get smallest displacement for location updates to trigger, in meters.
|
java.lang.String |
getStringExtra(java.lang.String key) |
int |
hashCode() |
IALocationRequest |
putExtra(java.lang.String key,
android.os.Parcelable value) |
IALocationRequest |
putExtra(java.lang.String key,
java.lang.String value) |
IALocationRequest |
setFastestInterval(long millis)
Explicitly set the fastest interval for location updates, in milliseconds.
|
IALocationRequest |
setPriority(int priority)
Set the priority of the location request.
|
IALocationRequest |
setSmallestDisplacement(float meters)
Set the minimum displacement between location updates in meters.
|
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final int PRIORITY_LOW_POWER
setPriority(int)
,
Constant Field Valuespublic static final int PRIORITY_HIGH_ACCURACY
setPriority(int)
,
Constant Field Valuespublic static final android.os.Parcelable.Creator<IALocationRequest> CREATOR
public static IALocationRequest create()
public IALocationRequest putExtra(java.lang.String key, java.lang.String value)
public IALocationRequest putExtra(java.lang.String key, android.os.Parcelable value)
public java.lang.String getStringExtra(java.lang.String key)
public IALocationRequest setFastestInterval(long millis)
This controls the fastest rate at which your application will receive location updates. The actual rate can be slower than requested but no faster than requested.
There is now lower limit on the frequency but using a very small value may effect your application performance.
If no value is set, the default value is 5Hz, i.e. 200ms
public long getFastestInterval()
getFastestInterval()
. Actual frequency
may be slower.-1
if value was not setpublic IALocationRequest setSmallestDisplacement(float meters)
This controls how often your application will receive location updates. User needs to move
specified distance for the IALocationListener.onLocationChanged(IALocation)
to
trigger. First update will always be delivered as soon as one is available.
Requesting updates faster has only minimal impact on battery consumption and will not cause extra network load.
public float getSmallestDisplacement()
-1
if not set.public IALocationRequest setPriority(int priority) throws java.lang.IllegalArgumentException
You can use this to set the priority of the request to either
low power
or
high accuracy
for the positioning.
With the low power priority, one can expect positioning which has very low battery
consumption. Low power positioning can be efficiently combined with
fastest interval
setting to control
the power usage of positioning.
java.lang.IllegalArgumentException
- if priority
is not
PRIORITY_LOW_POWER
or
PRIORITY_HIGH_ACCURACY
.public int getPriority()
PRIORITY_HIGH_ACCURACY
or
PRIORITY_LOW_POWER
)setPriority(int)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public <T extends android.os.Parcelable> T getParcelableExtra(java.lang.String key)
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable