I know there have been some previous posts on this question.
Since Sensor.Type_Orientation has been deprecated, the right thing to
do is call SensorManager.getOrientation() .
I would note that the API Demos Compass still uses the
Sensor.Type_Orientation, so it is no help in telling
So far so good: SensorManager.getOrientation() is supported back to
API level three.
But I do need to register for something so I know when the rotation
has changed. Although docs don't say *when* something is deprecated,
I'm assuming this is API level 9.
So should I do this?
if(Versioning.getSDKNumber()<9)
{
boolean supported =
mSensorManager.registerListener(this,
mSensorManager
.getDefaultSensor(Sensor.TYPE_ORIENTATION),
SensorManager.SENSOR_DELAY_UI);
}
}
else
{
boolean supported =
mSensorManager.registerListener(this,
mSensorManager
.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR),
SensorManager.SENSOR_DELAY_UI);
}
Or is it somehow more complicated?
I'm extra concerned because it appears, based on my error reports in
console, that some devices fail when I call
registerListener with Sensor.TYPE_ORIENTATION. They don't return
false, they don't return an exception.
I don't know what devices they are because the Market Console won't
tell me. If they are API 9 devices (2.3), the above code will help. If
they are API 8 devices, then I am a bit stuck, because I can't use
Sensor.TYPE_ORIENTATION nor Sensor.TYPE_ROTATION_VECTOR.
Nathan
--
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