Hello,

I have double checked the code that returns the sensor list and it
seems correct.
You definitely don't want to use SensorManager.SENSOR_ACCELEROMETER,
which is a deprecated constant for the 1.0 API.

The correct way to retrieve a sensor is to do the following:

Sensor s = getDefaultSensor( Sensor.TYPE_ACCELEROMETER );

you can also do:

Sensor s = getSensorList( Sensor.TYPE_ACCELEROMETER ).get(0);

Using TYPE_ALL is incorrect because it's not guaranteed that the
accelerometer will be the first sensor and your application may break
in a future release or on a different phone.

I hope this helps.

mathias



On Dec 8, 3:16 am, Heiko <[email protected]> wrote:
> Problem solved. In case others experience the same problems:
>
> The constants for the sensors seem to be wrong. I used: getSensorList
> (SensorManager.SENSOR_ACCELEROMETER).get(0);  which returned a handle
> to the magnetic field sensor. Also the Sensor.TYPE_ACCELEROMETER
> constant returned a wrong handle. I solved it by manually looking up
> the list and choosing the accelerometer afterwards:
>
> getSensorList(Sensor.TYPE_ALL).get(0);
>
> Now getting sample rates from 120-170 samples/second.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to