Class LocationSensor
- java.lang.Object
-
- eu.h2020.helios_social.core.sensor.Sensor
-
- eu.h2020.helios_social.core.sensor.ext.LocationSensor
-
public class LocationSensor extends Sensor
This class provides an implementation of sensor API for obtaining GPS location. LocationSensor is a subclass of the abstract base class Sensor. It uses Android Fused Location Provider API to obtain position coordinates and updates to coordinates, as well as start and stop the location updates
-
-
Constructor Summary
Constructors Constructor Description LocationSensor(android.content.ContextWrapper appEnv)Creates a LocationSensorLocationSensor(java.lang.String id, android.content.ContextWrapper appEnv)Creates a LocationSensorLocationSensor(java.lang.String id, android.content.ContextWrapper appEnv, int updateInterval, int fastestUpdateInterval, int priority)Creates LocationSensor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description android.location.LocationgetLocation()Returns the last known locationvoidstartUpdates()Requests location updatesvoidstopUpdates()Stops location updates-
Methods inherited from class eu.h2020.helios_social.core.sensor.Sensor
finalize, getId, getSensorById, getValueListeners, receiveValue, registerValueListener, unregisterValueListener
-
-
-
-
Constructor Detail
-
LocationSensor
public LocationSensor(android.content.ContextWrapper appEnv)
Creates a LocationSensor- Parameters:
appEnv- the application environment (e.g. an Activity or a Service)
-
LocationSensor
public LocationSensor(java.lang.String id, android.content.ContextWrapper appEnv)Creates a LocationSensor- Parameters:
id- the identifier of thisappEnv- the application environment (e.g. an Activity or a Service)
-
LocationSensor
public LocationSensor(java.lang.String id, android.content.ContextWrapper appEnv, int updateInterval, int fastestUpdateInterval, int priority)Creates LocationSensor- Parameters:
id- the identifier of thisappEnv- the application environment (e.g. an Activity or a Service)updateInterval- the update interval of the locationfastestUpdateInterval- the fastest update intervalpriority- the location reguest priority value
-
-
Method Detail
-
startUpdates
public void startUpdates()
Requests location updates- Specified by:
startUpdatesin classSensor
-
stopUpdates
public void stopUpdates()
Stops location updates- Specified by:
stopUpdatesin classSensor
-
getLocation
public android.location.Location getLocation()
Returns the last known location- Returns:
- the Location
-
-