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 passIALocationRequestreturned fromcreate()Similarly to Android's LocationRequest API, IALocationRequest can be used to set
fastest intervalwhich controls the frequency of the received locations timewise.Smallest displacementcan be used to control the frequency with respect to displacement or change in the coordinates. If both thefastest intervalandsmallest discplacementare used together, both conditions are checked before the location is outputted to the application.Priorityof the IALocationRequest controls the mode of positioning and it emulates the Android's LocationRequest API as well. We can either requestlow powerpositions which enables efficient low-cost background usage of IndoorAtlas positioning, or we can requesthigh accuracyupdates when user needs very accurate locations.Priorityof 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>CREATORstatic intPRIORITY_CART_MODEConstant indicating cart mode positioningstatic intPRIORITY_HIGH_ACCURACYConstant indicating high accuracy positioning modestatic intPRIORITY_LOW_POWERConstant 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 IALocationRequestcreate()intdescribeContents()booleanequals(Object o)longgetFastestInterval()Get fastest interval of this request, in milliseconds.<T extends Parcelable>
TgetParcelableExtra(String key)intgetPriority()Return the priority of this requestfloatgetSmallestDisplacement()Get smallest displacement for location updates to trigger, in meters.StringgetStringExtra(String key)inthashCode()IALocationRequestputExtra(String key, Parcelable value)IALocationRequestputExtra(String key, String value)IALocationRequestsetFastestInterval(long millis)Explicitly set the fastest interval for location updates, in milliseconds.IALocationRequestsetPriority(int priority)Set the priority of the location request.IALocationRequestsetSmallestDisplacement(float meters)Set the minimum displacement between location updates in meters.voidwriteToParcel(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
-1if 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
-1if 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 powerorhigh accuracyfor 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 intervalsetting to control the power usage of positioning.- Throws:
IllegalArgumentException- ifpriorityis notPRIORITY_LOW_POWER,PRIORITY_HIGH_ACCURACYorPRIORITY_CART_MODE.
-
getPriority
public int getPriority()
Return the priority of this request- Returns:
- The priority (
PRIORITY_HIGH_ACCURACYorPRIORITY_LOW_POWER) - See Also:
setPriority(int)
-
getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String key)
-
describeContents
public int describeContents()
- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
public void writeToParcel(Parcel dest, int flags)
- Specified by:
writeToParcelin interfaceParcelable
-
-