android-sensors

Android: How to get Google Fit data from Wearable device?

无人久伴 提交于 2019-12-29 05:51:45
问题 I'm following the same steps described here (the Google Fit client connection part is working fine). final DataType dataType=TYPE_STEP_COUNT_DELTA; DataSourcesRequest requestData = new DataSourcesRequest.Builder() .setDataTypes(dataType) // At least one datatype must be specified. .build(); Fitness.SensorsApi.findDataSources(mClient, requestData) .setResultCallback(new ResultCallback<DataSourcesResult>() { @Override public void onResult(DataSourcesResult dataSourcesResult) { Log.i(TAG,

Can anyone tell me how i get toast when mobile falls down?

大憨熊 提交于 2019-12-25 19:02:08
问题 I am making an android project to detect when mobile fall down, can anyone tell me which sensor should I use in my app, I know accelerometer will use for this kind of purpose, but accelerometer can also detect when I shake the phone in my hand and I want to get the toast only when the mobile falls down. here is my code: int count = 1; private boolean init; private Sensor mySensor; private SensorManager SM; private float x1, x2, x3; private static final float ERROR = (float) 7.0; private

Can anyone tell me how i get toast when mobile falls down?

青春壹個敷衍的年華 提交于 2019-12-25 19:01:14
问题 I am making an android project to detect when mobile fall down, can anyone tell me which sensor should I use in my app, I know accelerometer will use for this kind of purpose, but accelerometer can also detect when I shake the phone in my hand and I want to get the toast only when the mobile falls down. here is my code: int count = 1; private boolean init; private Sensor mySensor; private SensorManager SM; private float x1, x2, x3; private static final float ERROR = (float) 7.0; private

Android: How to collect sensor values for a fixed period of time?

拜拜、爱过 提交于 2019-12-25 02:17:13
问题 I want to collect for ca. 5 seconds the values of the Accelerometer. What is a proper way to do this? I tried it by implementing an AsyncTask which registers and unregisters itself at the sensor manager for the accelerometer and then sleeps for 5 seconds. But during those 5s of sleeping the onSensorChanged method isn't invoked :D... The motivation behind my sought is the following: In order to calibrate my accelerometer I want to collect for some seconds sensor values (while the phone is

Filtering out noise from Android tilt (accelerometer and magnetic field) sensors?

為{幸葍}努か 提交于 2019-12-25 00:20:04
问题 So I have implemented a simple app on Android that makes the ball roll in the direction I tilt the phone. However it is impossible to keep the ball still since the sensor values are continously changing even if I think I am holding it still. So I guess what I want tis filter away small changes? Using some sort of lowpassfilter? So how would I do that? Keep the old rotationMatrix and not do any changes if the difference is not bigger than some threshold? 回答1: A low pass filter might make the

How to work with android and SensorSimulator to get sensors values and store them in database

寵の児 提交于 2019-12-24 15:33:48
问题 I'm working on an android application that gets sensor values from android phones in order to consume these values by a web service that stores them in a database . I don't have a real device for testing the sensors values so I used the sensor simulator [http://code.google.com/p/openintents/wiki/SensorSimulator][1] the problem now is that everytime I run the activity I get errors and here is the code of the activity (I'm using the API 15 Google APIs platform : 4.0.3) import org.openintents

how to determine device orientation from the sensors

断了今生、忘了曾经 提交于 2019-12-24 15:19:43
问题 My activity is locked on LANDSCAPE. But still I need to know the orientation of the device. So I have elected to use sensors. I have the following code sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_NORMAL); ... @Override public void onSensorChanged(SensorEvent event) { float[] values = event.values; // Movement float azimuth = values[0]; float pitch =

Android: Alternative to onSensorChanged? no ACCELEROMETER data when phone is lying on its back on a table( when no movement)

点点圈 提交于 2019-12-24 01:01:51
问题 So I'm using this code to get the Accelerometer data. When I am in the DDMS mode to check what my print statement is printing, I noticed that nothing is printed when the phone does not move. ie. its on the table. I think the reason is that onSensorChanged is not called when the phone does not move, and then its called when the phone starts moving again. If i want to capture data regardless of whether the phone is moving or not, should I use some other function? Any Alternatives? or Any

Rajawali rotating camera with Sensor.TYPE_ROTATION_VECTOR strange behavior

和自甴很熟 提交于 2019-12-23 20:06:51
问题 I'm creating a Panorama view which allows the user to look around in a spherical image by rotating his smartphone. I used Rajawali's Skybox for this together with the TYPE_ROTATION_VECTOR sensor. I got it working, but only when I look forward (it's literally based on my rotation (yaw)) This is the behavior: looking forward: yaw = yaw, pitch = pitch and roll = roll looking to the left: yaw = yaw, pitch = roll and roll = pitch looking backwards: yaw = yaw, pitch = pitch * -1 and roll = roll *

How to use Android's Sensor Batching without AlarmManager

拟墨画扇 提交于 2019-12-23 17:19:05
问题 I want to use Androids sensor batching introduced in Android 4.4 to save some battery power. My testing device can store 184 sensor events in its fifo-queue. Using a sampling rate of 18 events/seconds I have to flush the sensor about every 10 seconds. The section on Sensor Batching in the 4.4 Documentation proposes: Use that calculation to set wake alarms with AlarmManager that invoke your Service (which implements the SensorEventListener) to flush the sensor. Since Android 5.1 the minimum