android-sensors

Long running service consumes a lot of battery

一个人想着一个人 提交于 2019-12-21 11:13:08
问题 I developed an app and some people complains that it takes too much battery, it is the second most consuming process after the screen. However, in some devices it does not consumes that much battery. All the work my app do is in a service. The service is sticky and is running all the time (the android system may kill it when has low resources or pause it when device go to sleep), it has listener to the accelerometer as long as the screen is on, it is not foreground service and does not hold

Android accelerometer, sensor usage and power consumption

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:27:12
问题 I have a quick question about the accelerometer in Android devices. Is it always on/active? Given that accelerometer is used to detect the orientation of the device, either landscape or portrait. In the official documentation ( SensorManager ) it states that sensors should be turned off to save power. But I wonder if this only applies to others sensors like magnetic field sensors, gyroscope, light sensor and so on. I need to make a case for power conservation and I don't want to make the

What sensors does ARCore use?

时光毁灭记忆、已成空白 提交于 2019-12-21 02:35:45
问题 What sensors does ARCore use: single camera, dual-camera, IMU, etc. in a compatible phone? Also, is ARCore dynamic enough to still work if a sensor is not available by switching to a less accurate version of itself? 回答1: UPDATED November 24, 2019 . Google's ARCore , as well as Apple's ARKit , use the same types of sensors to track a real-world scene. ARCore uses a single RGB camera along with IMU device, what is a combination of an accelerometer , magnetometer and a gyroscope . Your phone can

Gyroscope Issues with Device Orientation

浪尽此生 提交于 2019-12-20 09:44:44
问题 I'm getting pitch and roll data from my device's gyroscope using this tutorial: http://www.thousand-thoughts.com/2012/03/android-sensor-fusion-tutorial/ All the readings are extremely accurate (there's a filter applied to the code in the tutorial to eliminate gyro drift). Unfortunately, the code only works when my device is placed flat on a surface that is parallel to the ground. The most ideal position for my app to work would be with the top of the device pointing straight up (ie, the

Detect user activity (running, cycling, driving) using Android

試著忘記壹切 提交于 2019-12-20 09:20:50
问题 Using my Android device how can I detect if the user is walking, cycling or driving? I have checked the Google Fit app. It differentiates between running, cycling and driving. I am puzzled about what algorithms I should use to differentiate between these activities. I know I would have to use the accelerometer sensor. But still I can't differentiate these activities. 回答1: You can use the GooglePlayServices for this. It Provides special apis for ActivityRecognition, which returns the User

How to check accuracy values on OnAccuracyChanged method in sensor event listening Activity?

有些话、适合烂在心里 提交于 2019-12-20 06:15:41
问题 I'm making an application that works as a compass, though I want to calibrate the accelerometer and the magneticfield sensors to make it more efficient. From the API I understand that this is possible, and that there are some values that you can check, for example: SENSOR_STATUS_ACCURACY_HIGH How can I achieve this value? I was thinking inside OnAccuracyChanged , but don't know how! 回答1: The OnAccuracyChanged method of your listener is invoked by system, when a sensor begins to report with

android: why getrotationmatrix return false?

折月煮酒 提交于 2019-12-19 07:51:35
问题 I want to get the orientation of my phone and I have using this code that I find lot of people using it. this is the code public void onSensorChanged(SensorEvent event) { //if the data sensor is unreliabel if(event.accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) return; //gets the value switch (event.sensor.getType()) { case Sensor.TYPE_ACCELEROMETER: gravity = event.values.clone(); break; case Sensor.TYPE_MAGNETIC_FIELD: geomag = event.values.clone(); break; } getOrientation(); } private

Magnetic Fields, Rotation Matrix And global coordinates

為{幸葍}努か 提交于 2019-12-18 18:28:21
问题 I think that i've read all the posts about this subject, but still i cant understand a few things: Q1: To get the magnetic field vector in global coords i need to multiply the inverted rotation matrix and the magnetic field vector, why do i need to invert the rotation matrix? Q2: Lets say that i have a device and i can calculate the azimuth based on the rotation along the Z-axis using getOrientation(...) method. can i use the rotation matrix or some other method to calculate the azimuth to

Which sensor for rotating android phone?

不问归期 提交于 2019-12-18 18:04:22
问题 Imagine you are pointing at the TV. You have your phone gripped in your hand. Now, rotate your wrist. Which sensor would I need to manage to detect such a movement? Gyroscope? Orientation? Accelerometer? 回答1: The sensors TYPE_MAGNETIC_FIELD and TYPE_ACCELEROMETER are fine to detect that (as TYPE_ORIENTATION is now deprecated). You will need: a few matrix: private float[] mValuesMagnet = new float[3]; private float[] mValuesAccel = new float[3]; private float[] mValuesOrientation = new float[3

Proximity sensor on Galaxy S4 (Air Gestures)

筅森魡賤 提交于 2019-12-18 11:27:12
问题 The new Samsung Galaxy S4 have and interesting new type of gestures called " Air Gesture " that use an infrared sensor to process users hand movement in front of the screen, adding a " pre-touch "/" proximity " event, in wich the fingers are detected before the touch. I'd like to use this " Floating Touch " event in one of my apps. I searched both on Google and in the Samsung Developers Center, but I coudnt find any API or information about that. Are the API available or is too early? Does