Why i can not use Sensor.TYPE_ORIENTATION_VECTOR. Type is not recognised
The problem is, that this sensors should be available:
- int TYPE_ACCELEROMETER
- int TYPE_ALL
- int TYPE_GRAVITY
- int TYPE_GYROSCOPE
- int TYPE_LIGHT
- int *TYPE_LINEAR_ACCELERATION*
- int TYPE_MAGNETIC_FIELD
- int TYPE_ORIENTATION
- int TYPE_PRESSURE
- int TYPE_PROXIMITY
- int TYPE_ROTATION_VECTOR
- int TYPE_TEMPERATURE
Why are these three disabled? They are not recognised..."TYPE_ROTATION_VECTOR cannot be resolved or is not a field"
Only these are recognised:
- int TYPE_ACCELEROMETER
- int TYPE_ALL
- int TYPE_GYROSCOPE
- int TYPE_LIGHT
- int TYPE_MAGNETIC开发者_开发问答_FIELD
- int TYPE_ORIENTATION
- int TYPE_PRESSURE
- int TYPE_PROXIMITY
- int TYPE_TEMPERATURE
code is:
mRotationVectorSensor = mSensorManager.getDefaultSensor(
Sensor.TYPE_ROTATION_VECTOR);
Project build target is 2.2, API 8. Why i can not use TYPE_ROTATION_VECTOR and other types?
Tnx for andswer!
You are trying to access a sensor that is available only from API version 9 (you are using API version 8). http://developer.android.com/reference/android/hardware/Sensor.html#TYPE_ROTATION_VECTOR
Check the "Since API level ..." at the right of each method/field
in Android 2.2, Gravity and linear Acceleration Vectors are not available... Only for versions 2.3 (GingerBread) and newer...
Greetings Ralf
精彩评论