草庐IT

SensorManager

全部标签

java - 如何替换 android 4.0.3 的 type_orientation(已弃用)?

您好,我想使用类型type_orientation但它已被android4.0.3弃用。我将它用于增强现实。我试图在网上找到但没有成功。我的应用程序有效,但我里面的文字留在同一个地方!这是我的代码:@OverrideprotectedvoidonStart(){super.onStart();sensorMngr=(SensorManager)getSystemService(Context.SENSOR_SERVICE);sensorLstr=createListener();sensorMngr.registerListener(sensorLstr,sensorMngr.getD

java - 如何替换 android 4.0.3 的 type_orientation(已弃用)?

您好,我想使用类型type_orientation但它已被android4.0.3弃用。我将它用于增强现实。我试图在网上找到但没有成功。我的应用程序有效,但我里面的文字留在同一个地方!这是我的代码:@OverrideprotectedvoidonStart(){super.onStart();sensorMngr=(SensorManager)getSystemService(Context.SENSOR_SERVICE);sensorLstr=createListener();sensorMngr.registerListener(sensorLstr,sensorMngr.getD

Android 加速度计 : SensorManager. DATA_X 已弃用 - 现在怎么办?

我使用StackOverflow的一些建议编写了一个加速度计应用程序(用于学习目的)。一切正常,但我在代码中收到“SensorManager.DATA_X已弃用”消息作为警告://setupthetextviewsfordisplayingtheaccelerationsmAccValueViews[SensorManager.DATA_X]=(TextView)findViewById(R.id.accele_x_value);mAccValueViews[SensorManager.DATA_Y]=(TextView)findViewById(R.id.accele_y_value

Android 的 SensorManager 无法有效注销监听器

我的应用程序创建了一个Service,它覆盖了onStartCommand以创建一个SensorManager并将一个SensorEventListener附加到其中一个传感器:publicclassAccelerometerServiceextendsService{privateSensorManagersensorManager;privateSensorsensor;privateSensorEventListeneractiveListener;//...@OverridepublicintonStartCommand(Intentintent,intflags,intsta

android - SensorManager 中的 GRAVITY_EARTH 是什么?

我在资源中找到了这个值。/**Standardgravity(g)onEarth.Thisvalueisequivalentto1G*/publicstaticfinalfloatSTANDARD_GRAVITY=9.80665f;/**Sun'sgravityinSIunits(m/s^2)*/publicstaticfinalfloatGRAVITY_SUN=275.0f;/**Mercury'sgravityinSIunits(m/s^2)*/publicstaticfinalfloatGRAVITY_MERCURY=3.70f;/**Venus'gravityinSIunits

android - 如何使用 SensorManager.getOrientation 进行倾斜控制,例如 "My Paper Plane"?

安卓游戏MyPaperPlane是如何实现倾斜控制的一个很好的例子,但我一直在努力理解如何做类似的事情。我有以下使用getOrientation()的示例从传感器管理器。整件事都在pastebinhere.它只是将方向值打印到文本字段。这是最相关的fragment:privatevoidcomputeOrientation(){if(SensorManager.getRotationMatrix(m_rotationMatrix,null,m_lastMagFields,m_lastAccels)){SensorManager.getOrientation(m_rotationMatr