Class IALocationRequest
- java.lang.Object
-
- com.indooratlas.android.sdk.IALocationRequest
-
- All Implemented Interfaces:
Parcelable
public final class IALocationRequest extends Object implements Parcelable
Provides quality of service attributes to the
IALocationManager
. All values are optional, to use default values passIALocationRequest
returned fromcreate()
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 thefastest interval
andsmallest 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 requestlow power
positions which enables efficient low-cost background usage of IndoorAtlas positioning, or we can requesthigh 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)
withPRIORITY_LOW_POWER
. (seerequesting location updates
)B. Request high accuracy positions by using
setPriority(int)
withPRIORITY_HIGH_ACCURACY
.C. Remove high accuracy positions in B (see
In this scenario the application starts to receive low power positions after step A. After step B., the application starts to receive high accuracy positions seamlessly. Removing the high accuracy positions in C. leads to application receiving the low power positions again, seamlessly.removing location updates
).Battery consumption can be efficiently controlled by using
setPriority(int)
withsetFastestInterval(long)
. For example using an update interval of 15 seconds or more, leads to positioning consuming significantly less battery power.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<IALocationRequest>
CREATOR
static int
PRIORITY_CART_MODE
Constant indicating cart mode positioningstatic int
PRIORITY_HIGH_ACCURACY
Constant indicating high accuracy positioning modestatic int
PRIORITY_LOW_POWER
Constant indicating low power positioning mode-
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IALocationRequest
create()
int
describeContents()
boolean
equals(Object o)
long
getFastestInterval()
Get fastest interval of this request, in milliseconds.<T extends Parcelable>
TgetParcelableExtra(String key)
int
getPriority()
Return the priority of this requestfloat
getSmallestDisplacement()
Get smallest displacement for location updates to trigger, in meters.String
getStringExtra(String key)
int
hashCode()
IALocationRequest
putExtra(String key, Parcelable value)
IALocationRequest
putExtra(String key, 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(Parcel dest, int flags)
-
-
-
Field Detail
-
PRIORITY_LOW_POWER
public static final int PRIORITY_LOW_POWER
Constant indicating low power positioning mode- See Also:
setPriority(int)
, Constant Field Values
-
PRIORITY_HIGH_ACCURACY
public static final int PRIORITY_HIGH_ACCURACY
Constant indicating high accuracy positioning mode- See Also:
setPriority(int)
, Constant Field Values
-
PRIORITY_CART_MODE
public static final int PRIORITY_CART_MODE
Constant indicating cart mode positioning- See Also:
setPriority(int)
, Constant Field Values
-
CREATOR
public static final Parcelable.Creator<IALocationRequest> CREATOR
-
-
Method Detail
-
create
public static IALocationRequest create()
-
putExtra
public IALocationRequest putExtra(String key, String value)
-
putExtra
public IALocationRequest putExtra(String key, Parcelable value)
-
setFastestInterval
public IALocationRequest setFastestInterval(long millis)
Explicitly set the fastest interval for location updates, in milliseconds.
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
-
getFastestInterval
public long getFastestInterval()
Get fastest interval of this request, in milliseconds.
SDK will never provide updates faster thangetFastestInterval()
. Actual frequency may be slower.- Returns:
- fastest interval in milliseconds or
-1
if value was not set
-
setSmallestDisplacement
public IALocationRequest setSmallestDisplacement(float meters)
Set the minimum displacement between location updates in 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.
-
getSmallestDisplacement
public float getSmallestDisplacement()
Get smallest displacement for location updates to trigger, in meters.- Returns:
- minimum displacement between location updates in meters or
-1
if not set.
-
setPriority
public IALocationRequest setPriority(int priority) throws IllegalArgumentException
Set the priority of the location request.You can use this to set the priority of the request to either
low power
orhigh 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
High accuracy positioning provides best possible accuracy for active positioning tracking. High accuracy positioning has increased power consumption compared to low power positioning but the accuracy is also greatly improved.fastest interval
setting to control the power usage of positioning.- Throws:
IllegalArgumentException
- ifpriority
is notPRIORITY_LOW_POWER
,PRIORITY_HIGH_ACCURACY
orPRIORITY_CART_MODE
.
-
getPriority
public int getPriority()
Return the priority of this request- Returns:
- The priority (
PRIORITY_HIGH_ACCURACY
orPRIORITY_LOW_POWER
) - See Also:
setPriority(int)
-
getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String key)
-
describeContents
public int describeContents()
- Specified by:
describeContents
in interfaceParcelable
-
writeToParcel
public void writeToParcel(Parcel dest, int flags)
- Specified by:
writeToParcel
in interfaceParcelable
-
-