android-sensors

Get Android rotation angle in x-axis

久未见 提交于 2019-11-29 05:08:35
I'm experimenting with some Android functions. Right now, I'm trying to get the rotation angle of the device, so when I show a happy face bitmap on a canvas, it always looks "straight". All I would need for this, is to get the x-axis rotation angle (I guess) but I can't find how to achieve it. Hope you can help me. Thank you. There is azimuth, pitch and roll available to you. Not sure which one relates to your "x-axis" but I think its azimuth. Time for helpful links: http://www.workingfromhere.com/blog/2009/03/30/orientation-sensor-tips-in-android/ http://marakana.com/forums/android/examples

Android: get device orientation from Azimuth, roll & pitch

别说谁变了你拦得住时间么 提交于 2019-11-28 17:40:49
I need to get the updated device orientation, but I have to fix my activity to Portrait (which I did in the layout xml file), which prevents me from using this: int rotation = getWindowManager().getDefaultDisplay().getRotation(); because it always gives me the portrait rotation, So, I'm trying to rely on the sensors. I found that Sensor.TYPE_ORIENTATION is deprecated, so I'm using a combination of Sensor.TYPE_ACCELEROMETER & Sensor.TYPE_MAGNETIC_FIELD and here is the event listener: SensorEventListener sensorEventListener = new SensorEventListener() { float[] mGravity; float[] mGeomagnetic;

How can I get the magnetic field vector, independent of the device rotation?

狂风中的少年 提交于 2019-11-28 13:23:27
What I want to archieve is a sort of "magnetic fingerprint" of a location. I use the MAGNETIC_FIELD sensor and in the event I get the 3 values for the (unfortunately not further explained) X, Y and Z axis. Problem is, that the values change as I rotate the device, so I guess the 3 axis are relative to the device. What I'd need is to compensate the device rotation so that I get the same 3 values, regardless of how the device is rotated. I tried to multiply with the rotation matrix (I know how to get that), tried to multiply with the inclination matrix and so on, but nothing works. Regardless of

Is it possible to simulate accelerometer motion on a real (not emulated) device?

£可爱£侵袭症+ 提交于 2019-11-28 11:41:03
问题 Is it possible to transmit fake values to the accelerometer sensor like it is possible with GPS coordinates? 回答1: If you mean the GPS location, then yes, you can fake that (look at the very bottom of the page): Android DDMS Using the DDMS, you can simply tell your device its current GPS coordinates. EDIT: I guess, this post answers your question Stackoverflow. It points out that SensorSimulator is capable of doing that. If you scroll down a little bit on the page, it explains you how to

Android proximity sensor issue only in Samsung devices

核能气质少年 提交于 2019-11-28 11:13:44
Specific scenario to avoid problems: Behaviour for Activity in Samsung devices was different in the manner that every time there was a change detected, for proximity, it resulted in a call to onPause()/onResume() ONLY on SAMSUNG devices. I was clearing the proximity sensors in onPause() which resulted in a behaviour unique to Samsung devices. Hope this saves some time for anybody who's facing this. I removed the call of clearing proximity listeners from onPause() and now it works as expected on the mentioned devices. UPDATE: What is mentioned below is not the only issue, the proximity sensor

How can I ensure compatibility between Android API levels for RotationVector?

给你一囗甜甜゛ 提交于 2019-11-28 09:51:59
问题 I have an Android app that's using the Rotation Vector sensor. Having read the comment here, I see that with newer API levels, the SensorEvent contains 4-5 values, instead of 3. My code uses an arraycopy for the data. lastRotVal is a class member and is initialized as an array of size [3]. Here's the relevant parts of the code responding to the sensor events. public void onSensorChanged(SensorEvent event) { System.arraycopy(event.values, 0, lastRotVal, 0, 3); //Hardcoded size lastRotValSet =

Is my “hal_process_report_ind: Bad item quality: 11” something to worry about?

你。 提交于 2019-11-28 07:34:43
问题 I get this error in LogCat while doing dev work. Sounds like a hardware malfunction. Is it? What's it in relation to? I tried searching but found only people talking about cameras. It's on a Motorola Razr M. My device acts quirky a lot (feedback delays often when unlocking and freezing temporarily while playing games) and I wonder if this has something to do with it. Thanks! PID TID Application Tag Text 698 710 qcom_sensors_hal hal_process_report_ind: Bad item quality: 11 (with some context)

Compass readings on SGS III

穿精又带淫゛_ 提交于 2019-11-28 06:47:57
问题 My app needs to show the current bearing of the device using its compass. The code I'm using (below) works perfectly fine on my Galaxy Nexus and Galaxy One, but the compass is spinning around wildly on a Samsung Galaxy S III. I've tried doing a figure-8 to recalibrate the device, but that doesn't change anything. The weird thing is that other compass apps downloaded from Google Play work just fine on the SIII. What could be the issue here? float[] mGravity; float[] mGeomagnetic; public void

android compass seems unreliable

自作多情 提交于 2019-11-28 05:08:08
I have been working on a small compass app the past couple of days, and have gotten the code up and running, but it seems that the compass reading is not accurate. After calibrating both phones, my first test that i found this in what that i simply held the phone against and flat surface looked at the reading then flipped it horizontally and put it against the same flat surface (a 180* turn) and the value did not change 180* it was closer to 240*. I then tested the reading vs a compass, at times the reading seemed to be close but at other points it was more than 50* off. I even tried to put my

How to make an accurate compass on android

两盒软妹~` 提交于 2019-11-28 03:29:54
my android application shows the direction of a particular place in the world and therefore in needs to get the compass degree. This is the code I've been using to calculate the degrees: public void getDirection() { mySensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); List<Sensor> mySensors = mySensorManager.getSensorList(Sensor.TYPE_ORIENTATION); if(mySensors.size() > 0){ mySensorManager.registerListener(mySensorEventListener, mySensors.get(0), SensorManager.SENSOR_DELAY_UI); } else{ TextView alert = (TextView)findViewById(R.id.instruct); alert.setText(getString(R.string