sensor


How to use onAccuracyChanged function in sensors

不打扰是莪最后的温柔 提交于 2020-01-26 02:54:10
问题 I am making an app in which am using two sensors. TYPE_MAGNETIC_FIELD TYPE_GRAVITY I initialized the respective sensors and then in onSensorChanged function, am fetching the data and doing the calculations on the same. I have one simple question, how can I use onAccuracyChanged function to filter out data? I want the data with medium and high accuracy!! I printed basic statements to see what kind of accuracy am getting while debugging the app. Code : `@Override public void onAccuracyChanged

PROXIMITY_SCREEN_OFF_WAKE_LOCK not working with Samsung

眉间皱痕 提交于 2020-01-16 18:07:51
问题 I am using the Proximity Sensor while webRtc call in android to turn screen on/off using device sensor. It is working perfectly in most of the devices but not in Samsung. When Sensor turns the screen off onStop() of the activity is called. Following is the code I am using : @Override public void onSensorChanged(SensorEvent sensorEvent) { if (sensorEvent.sensor.getType() == Sensor.TYPE_PROXIMITY) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (mWakeLock != null) { mWakeLock

Mahony's algorithm - Yaw angle becomes unstable when rotating device fast

寵の児 提交于 2020-01-15 12:23:50
问题 I'm newbie in sensor and IMU so my question is probably very basic for others, but it's already puzzled me for days. I'm using Mahony's algorithm to calculate Euler angle of my device; the three angles looks correct when put the device static or move/rotate the device slowly; however, the Yaw angle will become unstable and incorrect if rotating the device fast. Could someone help me solve this issue ? My device uses MPU-9150, I use the 6 parameters method of Mahony algorithm, that is to say,

How to convert a program that uses SensorListener to SensorEventListener

吃可爱长大的小学妹 提交于 2020-01-13 06:08:09
问题 I am creating an application named CompassApp. I have created two classes named Compass.java and Rose.java. This application has been created from a tutorial described in a website and this uses the deprecated version of SensorListener. The class Compass.java is using this deprecated version. The app worked fine when I used the deprecated version. Then I thought to convert my app into the current version that is SensorEventListener. But the rotation of the compass stopped! I'm stuck and don't

How to know if my SensorManager has a registered Sensor

南笙酒味 提交于 2020-01-12 07:48:25
问题 I'm using a sensor for my Android Application. I register the sensor with a line of code: mySensorManager.registerListener(this, orientationSensor, SensorManager.SENSOR_DELAY_NORMAL); I have introduced a line of code to unregister the listener so it wont be running all time: mySensorManager.unregisterListener(this); So far it works, but i need to register it again when the application resumes. I need to know if my sensorManager has a registered listener so I can registered again or skit it.

how to get device 's temperature in android [closed]

坚强是说给别人听的谎言 提交于 2020-01-10 02:06:51
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I want to get temperature from device. but I don t know how I can do. please help me writing simple. thanks. 回答1: You can use TYPE_AMBIENT_TEMPERATURE for battery or CPU temperature. TYPE_TEMPERATURE is the

Box2D: How to get the position of a sensor?

我怕爱的太早我们不能终老 提交于 2020-01-06 16:50:50
问题 Edit I've updated this question here: Box2D: How to get the position of a static body? I'm using sensors in a Box2D project. On a collision with a sensor, I'd like to know the sensor's position in the world. I'm detecting the collision with a contact listener, but the sensor's position is always 0 0. From my code: (edit, added the whole class) public class MyContactListener extends b2ContactListener { public var onSensorEvent:Function; override public function BeginContact(contact:b2Contact)

Android sensor listener does not get unregistered or sensor still retrieves values

久未见 提交于 2020-01-03 17:40:47
问题 I have some problems with SensorManager.unregisterListener. They are similar with Android, Thread, Cannot unregister SensorEventListener and SensorEventListener doesn't get unregistered with unregisterListener() method. But I could not find my answer! I also followed SensorManager documentation example http://developer.android.com/reference/android/hardware/SensorManager.html#SENSOR_DELAY_UI. The problem is that after the Activity is finished I unregister the listener but the sensor keeps

Android: How does one deal with inaccurate baromters?

孤人 提交于 2020-01-03 17:26:10
问题 I have been using a Samsung Galaxy S3 to work on an app that uses the barometer estimate the user's altitude. I use SensorManager.getAltitude(p0, p), and set p0 equal to the sea-level pressure reported at the nearest airport. I set p equal to the value returned by the barometer. Unfortunately, the altitude returned is systematically 20 meters or so higher than what it actually is. I'm certain that the barometer is returning pressure values that are too low, so SensorManager.getAltitude is

Android Convert device coordinate system to “user” coordinate system

痴心易碎 提交于 2020-01-03 12:26:29
问题 My question is similar to Changing sensor coordinate system in android I want to be able to compare a user's movements with each other regardless of device orientation. So that when the users holds out the phone in portrait orientation and bends his arm, acceleration readings are the same as when he holds out his phone in landscape and then bends his arm in the same direction. This is what I call the "user" coordinate system. It is different from the world coordinate system since it should

工具导航Map