AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Pedometer Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Pedometer:
com.google.appinventor.components.runtime.AndroidNonvisibleComponent com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.Deleteable com.google.appinventor.components.runtime.Component

Public Member Functions

 Pedometer (ComponentContainer container)
 
void Start ()
 
void Stop ()
 
void Reset ()
 
void Resume ()
 
void Pause ()
 
void Save ()
 
void SimpleStep (int simpleSteps, float distance)
 
void WalkStep (int walkSteps, float distance)
 
void StrideLength (float length)
 
float StrideLength ()
 
void StopDetectionTimeout (int timeout)
 
int StopDetectionTimeout ()
 
float Distance ()
 
long ElapsedTime ()
 
int SimpleSteps ()
 
int WalkSteps ()
 
void onAccuracyChanged (Sensor sensor, int accuracy)
 
void onSensorChanged (SensorEvent event)
 
void onDelete ()
 
void StartedMoving ()
 
void StoppedMoving ()
 
void UseGPS (boolean gps)
 
void CalibrationFailed ()
 
void GPSAvailable ()
 
void GPSLost ()
 
void CalibrateStrideLength (boolean cal)
 
boolean CalibrateStrideLength ()
 
boolean Moving ()
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
HandlesEventDispatching getDispatchDelegate ()
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
 AndroidNonvisibleComponent (Form form)
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
final Form form
 

Detailed Description

This component keeps count of steps using the accelerometer.

Definition at line 41 of file Pedometer.java.

Constructor & Destructor Documentation

◆ Pedometer()

com.google.appinventor.components.runtime.Pedometer.Pedometer ( ComponentContainer  container)

Constructor.

Definition at line 74 of file Pedometer.java.

Member Function Documentation

◆ CalibrateStrideLength() [1/2]

boolean com.google.appinventor.components.runtime.Pedometer.CalibrateStrideLength ( )

Definition at line 495 of file Pedometer.java.

◆ CalibrateStrideLength() [2/2]

void com.google.appinventor.components.runtime.Pedometer.CalibrateStrideLength ( boolean  cal)

Definition at line 490 of file Pedometer.java.

◆ CalibrationFailed()

void com.google.appinventor.components.runtime.Pedometer.CalibrationFailed ( )

Definition at line 472 of file Pedometer.java.

◆ Distance()

float com.google.appinventor.components.runtime.Pedometer.Distance ( )

Returns the approximate distance traveled in meters.

Returns
approximate distance traveled in meters.

Definition at line 273 of file Pedometer.java.

◆ ElapsedTime()

long com.google.appinventor.components.runtime.Pedometer.ElapsedTime ( )

Returns the time elapsed in milliseconds since the pedometer has started.

Returns
time elapsed in milliseconds since the pedometer was started.

Definition at line 284 of file Pedometer.java.

◆ GPSAvailable()

void com.google.appinventor.components.runtime.Pedometer.GPSAvailable ( )

Definition at line 477 of file Pedometer.java.

◆ GPSLost()

void com.google.appinventor.components.runtime.Pedometer.GPSLost ( )

Definition at line 482 of file Pedometer.java.

◆ Moving()

boolean com.google.appinventor.components.runtime.Pedometer.Moving ( )

Definition at line 501 of file Pedometer.java.

◆ onAccuracyChanged()

void com.google.appinventor.components.runtime.Pedometer.onAccuracyChanged ( Sensor  sensor,
int  accuracy 
)

Definition at line 365 of file Pedometer.java.

◆ onDelete()

void com.google.appinventor.components.runtime.Pedometer.onDelete ( )

◆ onSensorChanged()

void com.google.appinventor.components.runtime.Pedometer.onSensorChanged ( SensorEvent  event)

Definition at line 370 of file Pedometer.java.

◆ Pause()

void com.google.appinventor.components.runtime.Pedometer.Pause ( )

This method has been deprecated. Use Stop() instead.

Definition at line 155 of file Pedometer.java.

◆ Reset()

void com.google.appinventor.components.runtime.Pedometer.Reset ( )

Resets the step count, distance, and clock. @suppressdoc

Definition at line 133 of file Pedometer.java.

◆ Resume()

void com.google.appinventor.components.runtime.Pedometer.Resume ( )

This method has been deprecated. Use Start() instead.

Definition at line 146 of file Pedometer.java.

◆ Save()

void com.google.appinventor.components.runtime.Pedometer.Save ( )

Saves the pedometer state to shared preferences. @suppressdoc

Definition at line 166 of file Pedometer.java.

◆ SimpleStep()

void com.google.appinventor.components.runtime.Pedometer.SimpleStep ( int  simpleSteps,
float  distance 
)

Indicates that a step was taken.

Parameters
simpleStepsnumber of raw steps detected
distanceapproximate distance covered by number of simpleSteps in meters @suppressdoc

Definition at line 194 of file Pedometer.java.

◆ SimpleSteps()

int com.google.appinventor.components.runtime.Pedometer.SimpleSteps ( )

Returns the number of simple steps taken since the pedometer has started.

Returns
the number of simple steps since the pedometer was started.

Definition at line 299 of file Pedometer.java.

◆ Start()

void com.google.appinventor.components.runtime.Pedometer.Start ( )

Starts the pedometer.

Definition at line 105 of file Pedometer.java.

◆ StartedMoving()

void com.google.appinventor.components.runtime.Pedometer.StartedMoving ( )

Definition at line 455 of file Pedometer.java.

◆ Stop()

void com.google.appinventor.components.runtime.Pedometer.Stop ( )

Stops the pedometer.

Definition at line 119 of file Pedometer.java.

◆ StopDetectionTimeout() [1/2]

int com.google.appinventor.components.runtime.Pedometer.StopDetectionTimeout ( )

Returns the duration of idleness (no steps detected) after which to go into a "stopped" state.

Returns
the timeout in milliseconds.

Definition at line 262 of file Pedometer.java.

◆ StopDetectionTimeout() [2/2]

void com.google.appinventor.components.runtime.Pedometer.StopDetectionTimeout ( int  timeout)

Sets the duration of idleness (no steps detected) after which to go into a "stopped" state.

Parameters
timeoutthe timeout in milliseconds.

Definition at line 252 of file Pedometer.java.

◆ StoppedMoving()

void com.google.appinventor.components.runtime.Pedometer.StoppedMoving ( )

Definition at line 460 of file Pedometer.java.

◆ StrideLength() [1/2]

float com.google.appinventor.components.runtime.Pedometer.StrideLength ( )

Returns the current estimate of stride length in meters, if calibrated, or returns the default (0.73 m) otherwise.

Returns
length of the stride in meters.

Definition at line 237 of file Pedometer.java.

◆ StrideLength() [2/2]

void com.google.appinventor.components.runtime.Pedometer.StrideLength ( float  length)

Specifies the stride length in meters. The application can use this to explicitly set stride length to override the one calculated by the pedometer's calibration mechanism. As a side effect, this method turns off calibration of stride length using the GPS.

Parameters
lengthis the stride length in meters.

Definition at line 226 of file Pedometer.java.

◆ UseGPS()

void com.google.appinventor.components.runtime.Pedometer.UseGPS ( boolean  gps)

Definition at line 467 of file Pedometer.java.

◆ WalkStep()

void com.google.appinventor.components.runtime.Pedometer.WalkStep ( int  walkSteps,
float  distance 
)

Indicates that a step was taken while walking. This will not be called if a single step is taken while standing still.

Parameters
walkStepsnumber of walking steps detected
distanceapproximate distance covered by the number of walkSteps in meters @suppressdoc

Definition at line 208 of file Pedometer.java.

◆ WalkSteps()

int com.google.appinventor.components.runtime.Pedometer.WalkSteps ( )

Returns the number of walk steps taken since the pedometer has started.

Returns
the number of walk steps since the pedometer was started.

Definition at line 310 of file Pedometer.java.


The documentation for this class was generated from the following file: