Package com.iizix.geo
Class BackgroundLocationConfiguration
- java.lang.Object
- com.iizix.geo.BackgroundLocationConfiguration
public class BackgroundLocationConfiguration extends java.lang.Object
Class used to hold the information required for the background location service.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description BackgroundLocationConfiguration(int desiredAccuracy, int stationaryRadius, int distanceFilter, long interval)
Constructs the configuration for the location background service.BackgroundLocationConfiguration(int desiredAccuracy, int stationaryRadius, int distanceFilter, long interval, boolean stopOnTerminate, boolean startOnBoot)
Constructs the configuration for the location background service.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Checks for equality.int
getDesiredAccuracy()
Desired accuracy in meters.int
getDistanceFilter()
The minimum distance (measured in meters) a device must move horizontally before an update event is generated (see Apple docs).long
getInterval()
Gets the minimum time interval between location updates in milliseconds.boolean
getStartOnBoot()
[Android Only] Start background service on device boot.int
getStationaryRadius()
Stationary radius in meters.boolean
getStopOnTerminate()
Enable this in order to force a stop() when the application terminated (e.g.int
hashCode()
Hash code.boolean
isBackgroundModeUsed()
Gets the use of the background mode, i.e.void
setBackgroundMode(boolean useBackgroundMode)
Sets the use of the background mode, i.e.java.lang.String
toString()
String representation of the class.
Constructor Detail
BackgroundLocationConfiguration
public BackgroundLocationConfiguration(int desiredAccuracy, int stationaryRadius, int distanceFilter, long interval)
Constructs the configuration for the location background service.- Parameters:
desiredAccuracy
- Desired accuracy in meters. Possible values [0, 10, 100, 1000]. The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings. 1000 results in lowest power drain and least accurate readings.stationaryRadius
- Stationary radius in meters. When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage.distanceFilter
- The minimum distance (measured in meters) a device must move horizontally before an update event is generated (see Apple docs).interval
- [Android Only] The minimum time interval between location updates in milliseconds. Android docs for more information.- Throws:
java.lang.IllegalArgumentException
- If the parameters are invalid (negative values not allowed and interval cannot be zero).
BackgroundLocationConfiguration
public BackgroundLocationConfiguration(int desiredAccuracy, int stationaryRadius, int distanceFilter, long interval, boolean stopOnTerminate, boolean startOnBoot)
Constructs the configuration for the location background service.- Parameters:
desiredAccuracy
- Desired accuracy in meters. Possible values [0, 10, 100, 1000]. The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings. 1000 results in lowest power drain and least accurate readings.stationaryRadius
- Stationary radius in meters. When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage.distanceFilter
- The minimum distance (measured in meters) a device must move horizontally before an update event is generated (see Apple docs).interval
- [Android Only] The minimum time interval between location updates in milliseconds. Android docs for more information.stopOnTerminate
- Enable this in order to force a stop() when the application terminated (e.g. on iOS, double-tap home button, swipe away the app). (default true)startOnBoot
- [Android Only] Start background service on device boot. (default false)- Throws:
java.lang.IllegalArgumentException
- If the parameters are invalid (negative values not allowed and interval cannot be zero).
Method Detail
setBackgroundMode
public void setBackgroundMode(boolean useBackgroundMode)
Sets the use of the background mode, i.e. the plugin that sends location data even when program is not running.- Parameters:
useBackgroundMode
-
isBackgroundModeUsed
public boolean isBackgroundModeUsed()
Gets the use of the background mode, i.e. the plugin that sends location data even when program is not running.
getDesiredAccuracy
public int getDesiredAccuracy()
Desired accuracy in meters. Possible values [0, 10, 100, 1000]. The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings. 1000 results in lowest power drain and least accurate readings.
getStationaryRadius
public int getStationaryRadius()
Stationary radius in meters. When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage.
getDistanceFilter
public int getDistanceFilter()
The minimum distance (measured in meters) a device must move horizontally before an update event is generated (see Apple docs).
getInterval
public long getInterval()
Gets the minimum time interval between location updates in milliseconds. Android docs for more information.
getStopOnTerminate
public boolean getStopOnTerminate()
Enable this in order to force a stop() when the application terminated (e.g. on iOS, double-tap home button, swipe away the app). (default true)
getStartOnBoot
public boolean getStartOnBoot()
[Android Only] Start background service on device boot. (default false).
equals
public boolean equals(java.lang.Object o)
Checks for equality.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The object to compare with.- Returns:
- When equals, false otherwise.
hashCode
public int hashCode()
Hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- Returns the hash code.
toString
public java.lang.String toString()
String representation of the class.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string with user and distance.