Class 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 Detail

      • ActivityContext

        public ActivityContext​(java.lang.String name,
                               int activityType)
        Creates a ActivityContext
        Parameters:
        name - the name of the context
        activityType - 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 context
        name - the name of the context
        activityType - 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 sensor ActivitySensor. In order to receive the activity updates, this context should be registered as a SensorValueListener for the sensor.
        Specified by:
        receiveValue in interface SensorValueListener
        Parameters:
        value - the received value