Search code examples
androidsensorsandroid-sdk-2.3nexus-s

Nexus S sensor events -- have any one got their hands on?


Has anyone tried testing SensorEvents on Nexus S with gingerbread 2.3 What all SensorEvents does it support ? Specifically I am looking for these :

Sensor.TYPE_GRAVITY

Sensor.TYPE_LINEAR_ACCELERATION

and

Sensor.TYPE_ROTATION_VECTOR

Sensor.TYPE_GYROSCOPE

Can someone provide output of these events ? Does it support all of them ? This question is related to my old post for separating gravity from accelerometer readings found here.


Solution

  • Using the latest SDK downloaded a couple days ago (Android 2.3 API level 9) I see all the types you list. On a Nexus S a sensor listener for TYPE_GYROSCOPE and SENSOR_DELAY_UI generates a sensor changed event about every 10 msec:

    e SensorEvent (id=830009808440)
    accuracy 0
    sensor Sensor (id=830009014296)
    mHandle 5
    mLegacyType 0
    mMaxRange 34.906586
    mMinDelay 1200
    mName "K3G Gyroscope sensor" (id=830009014352)
    mPower 6.1 mResolution 0.0012217305
    mType 4
    mVendor "STMicroelectronics" (id=830009014448)
    mVersion 1
    timestamp 99044897424000
    values (id=830009808472)
    [0] 0.02687807
    [1] -0.009773844
    [2] -0.0012217305

    For TYPE_ROTATION_VECTOR I get an event about every 60 msec:

    e SensorEvent (id=830009257568)
    accuracy 3
    sensor Sensor (id=830009236640)
    mHandle 1601335158
    mLegacyType 0
    mMaxRange 1.0 mMinDelay 20000
    mName "Rotation Vector Sensor" (id=830009236696)
    mPower 7.03
    mResolution 5.9604645E-8
    mType 11
    mVendor "Google Inc." (id=830009236792) mVersion 1
    timestamp 99327490002000
    values (id=830009257600)
    [0] 0.47573996
    [1] -0.0030247832
    [2] -0.004710396

    For TYPE_LINEAR_ACCELERATION events also come in around every 60 msec:

    e SensorEvent (id=830009389592)
    accuracy 3
    sensor Sensor (id=830009013408)
    mHandle 1600940398
    mLegacyType 0
    mMaxRange 19.6133 mMinDelay 20000
    mName "Linear Acceleration Sensor" (id=830009013464)
    mPower 0.23
    mResolution 0.009576807 mType 10
    mVendor "Google Inc." (id=830009013568) mVersion 1
    timestamp 99619963498000
    values (id=830009389624)
    [0] -0.07089697 [1] 0.041391253 [2] -0.06359482

    For TYPE_GRAVITY events come in around every 60 msec:

    e SensorEvent (id=830009037864)
    accuracy 3
    sensor Sensor (id=830009017880)
    mHandle 1600615030
    mLegacyType 0
    mMaxRange 19.6133 mMinDelay 20000
    mName "Gravity Sensor" (id=830009017936)
    mPower 0.23
    mResolution 0.009576807 mType 9
    mVendor "Google Inc." (id=830009018016) mVersion 1
    timestamp 99772462046000
    values (id=830009037896)
    [0] 0.030116666 [1] 0.65991235
    [2] 9.721399