/** * Sets up an AccelerometerReader. Checks if Accelerometer is available on * this device and throws UnsupportedOperationException if not . * * @param doEnable : * enables the devices Accelerometer * initially (if sensor available) * @throws UnsupportedOperationException * if Accelerometer is not available on this device. */ public Accelerometer(boolean doEnable) throws UnsupportedOperationException {

/* Check once here in the constructor if an * Accelerometer is available on this device. */ for (String aSensor : Sensors.getSupportedSensors()) if (aSensor.equals(Sensors.SENSOR_ACCELEROMETER)) accelerometerAvailable = true;

if (!accelerometerAvailable) throw new UnsupportedOperationException( "Accelerometer is not available.");

/** * Read out the values currently provided by the Accelerometer. * * @return the current Accelerometer-values. * @throws UnsupportedOperationException * if Accelerometer is not available on this device. * @throws IllegalStateException * if Accelerometer was set to disabled. */ public float[] readAccelerometer() throws UnsupportedOperationException, IllegalStateException { if (!accelerometerAvailable) throw new UnsupportedOperationException( "Accelerometer is not available.");

if (!this.isEnabled) throw new IllegalStateException( "Accelerometer was set to disabled!"); /* Get number of sensor-values the sensor will return. Could be * variable, depending of the amount of axis (1D, 2D or 3D * accelerometer). */ int sensorValues = Sensors .getNumSensorValues(Sensors.SENSOR_ACCELEROMETER); float[] out = new float[sensorValues];

/* Make the OS fill the array we passed. */ Sensors.readSensor(Sensors.SENSOR_ACCELEROMETER, out);

/* And return it. */ return out; }}

i did not intend to change your code. i tried running your code exactly as it was given but got the following error

I am trying to install openintent.apk on the emulator. From the commandprompt when i say adb install openintent.apk, it shows that it has install the apk but on emulator screen it does not shows up. Am also not able to locate the application folder where it is supposedly to be installed in the emulator.

have you messed with this by putting your application on the Google Phone? I would like to set the google phone to read the accelerometer data and to change configuration based on the No Hand's application my application development class is working on- to where the phone would switch to blue tooth if say the accelerometer tells notifies the system that the phone is going 15+ mph. willing to work in small steps like just being able to read the accelerometer data and put into txt. we do have a google phone to test with and the emulator on the computer.

Bretters wrote:have you messed with this by putting your application on the Google Phone? I would like to set the google phone to read the accelerometer data and to change configuration based on the No Hand's application my application development class is working on- to where the phone would switch to blue tooth if say the accelerometer tells notifies the system that the phone is going 15+ mph. willing to work in small steps like just being able to read the accelerometer data and put into txt. we do have a google phone to test with and the emulator on the computer.

There is an accelerometer game available in the apps-for-android project.