android-sensors

Collecting android sensor for a specific period and calculating the average

狂风中的少年 提交于 2020-06-12 05:11:22
问题 I am trying to write a method that collects accelerometer sensor values over a specific time period and returns the average of the sensor readings for that period. It should be a synchronous i.e. blocking method that once it is called will block the calling thread for sometime and then will return the sensor average I did check the below similar questions but does not seem to have a proper working solution for my case: SensorEventListener in separate thread Android - how to run your sensor (

What is the difference between TYPE_ACCELEROMETER and TYPE_LINEAR_ACCELERATION sensors?

对着背影说爱祢 提交于 2020-05-13 07:15:05
问题 I think TYPE_ACCELEROMETER shows devices acceleration. However, I can't understand when I should use TYPE_LINEAR_ACCELERATION ? I need to calculate the speed of moving the device. Which sensor is proper for this application? Also, I read that TYPE_LINEAR_ACCELERATION uses accelerometer and orientation to know where is directed the gravity and then subs. How is this possible? How Android find out about orientation of device and subtract it? 回答1: According to http://developer.android.com

What is the difference between TYPE_ACCELEROMETER and TYPE_LINEAR_ACCELERATION sensors?

谁说我不能喝 提交于 2020-05-13 07:14:45
问题 I think TYPE_ACCELEROMETER shows devices acceleration. However, I can't understand when I should use TYPE_LINEAR_ACCELERATION ? I need to calculate the speed of moving the device. Which sensor is proper for this application? Also, I read that TYPE_LINEAR_ACCELERATION uses accelerometer and orientation to know where is directed the gravity and then subs. How is this possible? How Android find out about orientation of device and subtract it? 回答1: According to http://developer.android.com

Android slows down foreground service when device sleeps

荒凉一梦 提交于 2020-05-11 06:52:06
问题 For a few days now im struggling with the following: I want to count movement patterns using the gravity sensor on an Android device while the screen is off. I am using a bound service that I start in the foreground (with a notification for Android 8 to keep it running) and everything works fine when the screen is on. Even if the App is not running in the foreground everything works fine. However, as soon as the display is turned off, very strange things start to happen: The sensor data is

How to find the direction of acceleration magnitude from three axes components of acceleration?

流过昼夜 提交于 2020-05-09 17:01:45
问题 What I am trying to do? Using the sensor of Android, I have collected lot of acceleration values when some diabetic patients were running to do physical exercise. Each acceleration value consists of three components: Acceleration in x axis, acceleration in y axis, acceleration in z axis. Then, I need to calculate the total magnitude of each acceleration value and it's direction. Then, what does create the problem? In my data, the direction of acceleration components (x, y, z) are represented

How to find the direction of acceleration magnitude from three axes components of acceleration?

懵懂的女人 提交于 2020-05-09 17:01:11
问题 What I am trying to do? Using the sensor of Android, I have collected lot of acceleration values when some diabetic patients were running to do physical exercise. Each acceleration value consists of three components: Acceleration in x axis, acceleration in y axis, acceleration in z axis. Then, I need to calculate the total magnitude of each acceleration value and it's direction. Then, what does create the problem? In my data, the direction of acceleration components (x, y, z) are represented