Class ActivityContext
- java.lang.Object
-
- eu.h2020.helios_social.core.context.Context
-
- eu.h2020.helios_social.core.context.ext.ActivityContext
-
- All Implemented Interfaces:
SensorValueListener
public class ActivityContext extends Context implements SensorValueListener
ActivityContext - an activity-based context class
This class is used to detect an activity of given type. The allowed activity types include: IN_VEHICLE, ON_FOOT, RUNNING, WALKING, ON_BICYCLE and STILL.- See Also:
This class extends the base class Context. Activity value updates are obtained from ActivitySensor via SensorValueListener
-
-
Constructor Summary
Constructors Constructor Description ActivityContext(java.lang.String name, int activityType)
Creates a ActivityContextActivityContext(java.lang.String id, java.lang.String name, int activityType)
Creates a ActivityContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getActivityType()
int
getConfidence()
Gets the confidence of the activityvoid
receiveValue(java.lang.Object value)
Receive updated activity values from the activity sensorActivitySensor
.-
Methods inherited from class eu.h2020.helios_social.core.context.Context
addSensor, addSensors, getContextListeners, getId, getName, getSensors, isActive, registerContextListener, removeSensor, setActive, setName, unregisterContextListener
-
-
-
-
Constructor Detail
-
ActivityContext
public ActivityContext(java.lang.String name, int activityType)
Creates a ActivityContext- Parameters:
name
- the name of the contextactivityType
- the activity type. @see com.google.android.gms.location.DetectedActivity
-
ActivityContext
public ActivityContext(java.lang.String id, java.lang.String name, int activityType)
Creates a ActivityContext- Parameters:
id
- the identifier of the contextname
- the name of the contextactivityType
- the activity type. @see com.google.android.gms.location.DetectedActivity
-
-
Method Detail
-
getActivityType
public int getActivityType()
-
getConfidence
public int getConfidence()
Gets the confidence of the activity- Returns:
- the confidence value
-
receiveValue
public void receiveValue(java.lang.Object value)
Receive updated activity values from the activity sensorActivitySensor
. In order to receive the activity updates, this context should be registered as a SensorValueListener for the sensor.- Specified by:
receiveValue
in interfaceSensorValueListener
- Parameters:
value
- the received value
-
-