android-sensors

Parsing data from hdp device for android (API 15)

会有一股神秘感。 提交于 2019-11-29 16:32:55
问题 I am using the HDP Sample and I have a Blood pressure sensor (http://www.andonline.com/medical/products/details.php?catname=&product_num=UA-767PBT-C). I get the data from it, but I don't know how to parse it into something human readable. this is what I tried until now with something like: while(fis.read(data) > -1) { String value = null; BigInteger bi = new BigInteger(data); // for(byte b:data){ // value+=b; // } Log.d("read data binary", "the data "+bi.toString(2)); Log.d("read data decimal

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

末鹿安然 提交于 2019-11-29 15:51:57
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 = true; updateDisplay(event); } private void updateDisplay(SensorEvent event){ if (lastRotValSet){ float

Android light sensor - detect significant light changes

拥有回忆 提交于 2019-11-29 15:07:29
问题 I am new to sensor use in android and now a bit confused. I need to perform some actions only if there's a significant light change, e.g. the light was turned on in a dark room. I have a pretty simple default implementation so far. How can I tell the system I only want to react to a significant light change? public class MainActivity extends Activity implements SensorEventListener { private SensorManager mSensorManager; private Sensor mLight; private RelativeLayout mLayout; @Override

Compass readings on SGS III

那年仲夏 提交于 2019-11-29 12:36:53
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 onSensorChanged( SensorEvent event ) { float azimuth = 0f; if (event.sensor.getType() == Sensor.TYPE

Android sensor listening when app in background

左心房为你撑大大i 提交于 2019-11-29 12:24:41
问题 Is it possible to track motion sensor events on Android continuously, even if the app is not in foreground? If yes - what's the drain on battery? A client asked if it would be possible to write an app that would initiate an action if the person "falls" - which basically means continuously listening to the motion sensor for rapid movement. 回答1: First, you can definitely monitor the sensors in the background. You need to use a service for that type of application. Here is an example of someone

Android: Is there a way to obtain altitude aside from Location.getAltitude()? (I've heard using Sensor)

こ雲淡風輕ζ 提交于 2019-11-29 11:56:29
Is there a way to obtain altitude aside from Location.getAltitude()? I've heard using Sensor but don't have idea and can't find on net. UPDATES1 I found SensorManager.getAltitude(float, float) using API Level 9 up but don't have idea on how to implement it. Would you share with us. I know it's late but for anyone looking for it, that might help import android.app.Activity; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; public class MyActivity extends Activity

Compass give me crazy data, is calibration needed or it's the sensor broken?

对着背影说爱祢 提交于 2019-11-29 09:27:21
I'm working with android sensor data. My application use SensorManager.getRotationMatrixFromVector( mRotationMatrix , event.values); and it has been working well until this morning, when the rotation matrix started to send a lot of noise data (Change N to W in a second). It's not a problem with my code, because on friday was working and no changes have been done. I have used a compass app from the market, and the compass is giving random data. I have tested my app on another tablet, and it is working well. Does someone know why is this happening? A problem with the sensor? Does it need a

Get Device Moving Direction without GPS

谁说我不能喝 提交于 2019-11-29 08:52:32
With Which Sensor I Can Detect when device is moving to a direction In Absolute Coordinate(for example moving to +x or -x). I need accurate data,so i cannot use GPS . the Complete Task is to plot in paint(in computer) with android device sensors and this part of task in unknown for me. I'm a little confused about what you're asking. Do you want to put a device in your pocket and walk around, and make a plot of everywhere you walked? Or do you want to wave the device around in your hand like a 3-d mouse, for painting? For the latter, see Ali's suggestion above. If you want to do motion tracking

Vintage Thermometer component + SensorSimulator on the Android emulator

心已入冬 提交于 2019-11-29 08:49:33
After I found this nice custom component that analogly (is this the right word?) displays the temperature read from the Android device's temperature sensor, I wanted to test it with the emulator to see how it works so I've found this Sensor Simulator and altered the component's source to work with it. I did manage it to work on en emulated device, however I've done a few lucky guesses and'd like to know what exactly I've done :-) Here are the changes in thermometer's code I had to make to get it to work in conjunction with the temperature sensor simulator: After importing the sensorsimulator

How to read Android accelerometer values in a stable and accurate way?

送分小仙女□ 提交于 2019-11-29 05:13:33
In a my project I am trying to control a car using data obtained through the accelerometer of an Android device. (Left, Right, Forward, Reverse). Even though I have managed to read values from the accelerometer the readings are subject to frequent changes even the device is in a stable position. Can someone provide me a better way to do this? Following is the code that I have used import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; public class