为什么我不能使用 Sensor.TYPE_ORIENTATION_VECTOR。类型无法识别

发布于 2024-12-05 16:14:24 字数 1030 浏览 4 评论 0原文

问题是,此传感器应该可用:

  • 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

为什么这三个被禁用?它们无法识别...“TYPE_ROTATION_VECTOR 无法解析或不是字段”

仅识别这些:

  • 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

代码是:

        mRotationVectorSensor = mSensorManager.getDefaultSensor(
                Sensor.TYPE_ROTATION_VECTOR);

项目构建目标是 2.2,API 8。 为什么我不能使用 TYPE_ROTATION_VECTOR 和其他类型?

Tnx 回答!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情感失落者 2024-12-12 16:14:24

您正在尝试访问仅适用于 API 版本 9 的传感器(您正在使用 API 版本 8)。
http://developer.android.com/reference/android/hardware/Sensor .html#TYPE_ROTATION_VECTOR

检查每个方法/字段右侧的“自 API 级别...”

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

我三岁 2024-12-12 16:14:24

在 Android 2.2 中,重力和线性加速度矢量不可用...
仅适用于版本 2.3 (GingerBread) 和更新版本...

问候拉尔夫

in Android 2.2, Gravity and linear Acceleration Vectors are not available...
Only for versions 2.3 (GingerBread) and newer...

Greetings Ralf

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文