sensor

Sensor StepCounter sometime not work well on SamSung device

人走茶凉 提交于 2019-12-11 00:15:07
问题 I am create a demo from receive step from reboot like this. public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager sensorManager; @Override public void onCreate(Bundle savedInstanceState) { ... sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); } @Override protected void onResume() { super.onResume(); countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); sensorManager.registerListener(this,

flash.sensors.Accelerometer on Android within web browser

早过忘川 提交于 2019-12-10 23:32:31
问题 The Accelerometer UPDATE event never fires, tho isSupported returns true, when the flash app is running inside the android web browser. How can I make it work? this.accelerometer = new Accelerometer(); accelerometer.addEventListener(AccelerometerEvent.UPDATE, onAccelerometerUpdate); Ref: http://blogs.adobe.com/cantrell/archives/2010/04/simple_accelerometer_example.html Ref: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sensors/Accelerometer.html#isSupported My

onSensorChanged() not called

99封情书 提交于 2019-12-10 20:54:49
问题 I am coding an Android application but I have some trouble using the accelerometer. Strangely, my function onSensorChanged() is not called and I don't know why :/ Could you help me please ? :) Here's my code : @SuppressLint("NewApi") public class Game extends Activity implements SensorEventListener { SensorManager sensorManager; ImageView vaisseau; TextView test; RelativeLayout rl; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

How to convert the value get from Temperature Sensor?

冷暖自知 提交于 2019-12-10 20:41:20
问题 I am working on ST Temperature sensor( hts221 ) , I use I2C command communication with sensor. I see from the document like the following text. enter code here Temperature data are expressed as TEMP_OUT_H & TEMP_OUT_L as 2’s complement numbers. And the following picture is the description from document. And the Temperature data read from the sensor is like the following TEMP_OUT_L is 0xA8 TEMP_OUT_H is 0xFF How to convert the value of TEMP_OUT_L and TEMP_OUT_H to the Temperature data ? Thanks

How to adequatly replace Sensor.TYPE_ORIENTATION (which is now deprecated)?

我怕爱的太早我们不能终老 提交于 2019-12-10 14:55:05
问题 I've tried several code snippets found on the internet in SensorManager.getOrientation() - related discussions. None give magnetic azimuth reliably, as Sensor.TYPE_ORIENTATION did. Could anyone share a working code for Sensor.TYPE_ORIENTATION emulation? 来源: https://stackoverflow.com/questions/15109073/how-to-adequatly-replace-sensor-type-orientation-which-is-now-deprecated

How can i get device tilt?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 11:43:33
问题 I am trying to get device tilt (device rotation along y-axis but unfortunately i am unable to achieve my goal. I have tried a lot of stuff using TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD as a combined sensor (Sensor fusion). i have also followed Motion Sensors What i want? i want to get inclination of device (cell phone ) attached in a vehicle. Let say, i attached a device in a car and car is stationary. So inclination is 0 degrees.Lator on, when vehicle pass through under passes or flyovers

How to calibrate the Lego NXT color sensor with LeJos NXJ?

寵の児 提交于 2019-12-10 11:29:12
问题 I'm currently writing on a program about detecting different colored balls and sorting them with the Lego NXT and its color sensor. At the beginning it worked quite good but now, the color sensor always returnes the color ID "7" (white), no matter what i do. On the documentation page i found something about a calibration (calibrateHigh() and calibrateLow()). Does anybody know how to use this calibration or is my color sensor broken? I tried it with this code: package com.mydomain; import

Android accelerometer difficulties

不问归期 提交于 2019-12-09 23:19:58
问题 I'm a beginner in Android game Development, and I developing a small Game. I am facing some difficulties with the Motion Sensor: Accelerometer. this game is in Landscape mode. I want if my phone tilts in right, my character also goes right. ( same thing for left ) And when I stop tilting Character in the game should stop moving. But i don't understand really good the operation of the accelerometer, here is my code: @Override public void onSensorChanged(SensorEvent event) { synchronized (this)

获取Android获取传感器列表

感情迁移 提交于 2019-12-09 11:09:48
Android 4.4 (API等级19)支持以下传感器: TYPE_ACCELEROMETER 加速度传感器,单位是m/s2,测量应用于设备X、Y、Z轴上的加速度 传感器类型值(Sensor Type):1 (0x00000001) TYPE_AMBIENT_TEMPERATURE 温度传感器,单位是℃ 传感器类型值(Sensor Type): 13 (0x0000000d) TYPE_GAME_ROTATION_VECTOR 游戏动作传感器,不收电磁干扰影响 传感器类型值(Sensor Type):15 (0x0000000f) TYPE_GEOMAGNETIC_ROTATION_VECTOR 地磁旋转矢量传感器,提供手机的旋转矢量,当手机处于休眠状态时,仍可以记录设备的方位 传感器类型值(Sensor Type):20 (0x00000014) TYPE_GRAVITY 重力传感器,单位是m/s2,测量应用于设备X、Y、Z轴上的重力 传感器类型值(Sensor Type):9 (0x00000009) TYPE_GYROSCOPE 陀螺仪传感器,单位是rad/s,测量设备x、y、z三轴的角加速度 传感器类型值(Sensor Type):4 (0x00000004) TYPE_GYROSCOPE_UNCALIBRATED 未校准陀螺仪传感器,提供原始的,未校准、补偿的陀螺仪数据

Is there any way to monitor user's movement of iphone like the “raise to speak” feature?

大兔子大兔子 提交于 2019-12-09 06:35:19
问题 I want to get notified when the user raises the iphone to his face. Just like siri does. Is it possible? Add more specific requirement: I want to darken the screen when user put the phone near his ear. I know the Proximity Sensor can be enable to implement this. But it's annoying that the screen will be darkened from time to time when user moves the finger upon the sensor. So I wonder how to avoid this case and only darken the screen when user raise the iphone to speak? 回答1: See Using the