Skip to content

Basic accelerometer app for an Android device to demonstrate ease-of-use with the GWearCloud system

Notifications You must be signed in to change notification settings

gwulilab/AccelerometerExample

Repository files navigation

AccelerometerExample

Basic accelerometer app for an Android device to demonstrate ease-of-use with the GWearCloud system. The source code for this project can be found here and was not modified to make easier to use with the GWearCloud system in any way.

Required Software

Usage

Open the project in Android Studio, either as a git repository or as a directory downloaded from the zip file.

Build the project using Gradle.

Run it in an emulator or on a test device.

Adding GWearCloud capabilities

The purpose of this repository is to serve as a basis for testing the ease-of-use for the GWearCloud system. To participate in this study, download this project and add libgwearandroid to the project using the instructions found in the libgwearandroid README file.

For this project, new sensor data is read and processed in the onSensorChanged(SensorEvent event method. The method is copy-and-pasted below:

@Override
    public void onSensorChanged(SensorEvent event) {

        // clean current values
        displayCleanValues();
        // display the current x,y,z accelerometer values
        displayCurrentValues();
        // display the max x,y,z accelerometer values
        displayMaxValues();

        // get the change of the x,y,z values of the accelerometer
        deltaX = Math.abs(lastX - event.values[0]);
        deltaY = Math.abs(lastY - event.values[1]);
        deltaZ = Math.abs(lastZ - event.values[2]);

        // if the change is below 2, it is just plain noise
        if (deltaX < 2)
            deltaX = 0;
        if (deltaY < 2)
            deltaY = 0;
        if ((deltaX > vibrateThreshold) || (deltaY > vibrateThreshold) || (deltaZ > vibrateThreshold)) {
            v.vibrate(50);
        }
    }

Reporting Bugs

If you found any bugs or have any suggestions for this project, please feel free to submit an issue.

About

Basic accelerometer app for an Android device to demonstrate ease-of-use with the GWearCloud system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages