Questions tagged [android-sensors]

Android-sensors tag unites questions that are connected with different hardware sensors that are embedded into Android devices (barometer, accelerometer, magnetometer, microphone, camera and so on)

Sensor Class Reference

1574 questions
10
votes
4 answers

why there is a difference in the magnetic values taken by different smartphones?

I need to record the magnetic data in the same surface by two smartphones. I find different values of the magnitude of magnetic field knowing that I put my smartphones in the same place end the same height. The magnetometers are YAS532(sensitivity…
fao
  • 241
  • 2
  • 16
10
votes
1 answer

How does Doze mode affect registered listeners (especially sensor listeners)

How does Doze mode affect registered listeners? Also I would like to know how it does affect sensor listeners if possible. My problem is that I have a WatchFaceService with a wake lock permission in the manifest. The watchFace runs the onTimeTick…
Jimmy Kane
  • 14,040
  • 9
  • 73
  • 109
10
votes
1 answer

Android proximity sensor issue only in Samsung devices

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…
Pararth
  • 7,986
  • 4
  • 30
  • 51
10
votes
1 answer

How to plot real time sensor values in Graph in android?

I want to plot the graph of sensors value in android app. Which library will be perfect for this ?
pa1pal
  • 721
  • 3
  • 14
  • 30
10
votes
3 answers

How to get smooth orientation data in android

I have an app which uses orientation data which works very well using the pre API-8 method of using a Sensor.TYPE_ORIENTAITON. Smoothing that data was relatively easy. I am trying to update the code to avoid using this deprecated approach. The new…
Neil Townsend
  • 5,784
  • 5
  • 32
  • 50
10
votes
1 answer

How to control Android proximity sensor?

Can someone provide an example as to how to use the proximity sensor? Please describe some event and how to use them.
Maysam
  • 513
  • 4
  • 15
10
votes
6 answers

My Algorithm to Calculate Position of Smartphone - GPS and Sensors

I am developing an android application to calculate position based on Sensor's Data Accelerometer --> Calculate Linear Acceleration Magnetometer + Accelerometer --> Direction of movement The initial position will be taken from GPS (Latitude +…
Dawood Awan
  • 6,052
  • 10
  • 44
  • 109
10
votes
2 answers

how can we measure distance between object and android phone camera

I want to calculate the distance between the camera and the recognized object.For this I tried a lot of methods, I tried to find the angle between the object and the camera using accelerometer and then use d = h * tan a h is height of from from the…
Rats Tyagi
  • 618
  • 1
  • 8
  • 23
10
votes
5 answers

How to log data from Android Motion Sensors at a fixed rate

I'm learning the Basics of Android programming. I have a simple android test application in which i log the accelerometer,magnetometer and the orientation data to an external file while also displaying it. I initiate the logging process on click of…
this-Me
  • 2,077
  • 6
  • 39
  • 66
9
votes
3 answers

Android: Improve sensor sampling rate by use of NDK and polling

I want to write an application that reads as many sensor vaulues (per time) as possible from different sensors (GPS, Acc, Gyro, Compass). So I have to investigate if there is an advantage in using NDK. Here are my questions: a) What is the…
steckl
  • 374
  • 7
  • 16
9
votes
1 answer

HardwarePropertiesManager is not working

I am trying to access info using the HardwarePropertiesManager (https://developer.android.com/reference/android/os/HardwarePropertiesManager.html). I am using Android 7.0 (API Level 24) with the following code: public class MainActivity extends…
Serafeim
  • 13,804
  • 12
  • 76
  • 128
9
votes
2 answers

onSensorChanged() is not called

I'm having a lot of trouble tonight with sensors, but it appear it is because of onSensorChanged() is not called. Sorry for the eventual duplicate question, but I didn't see any solutions. Here's my code : public SensorManager manager; public Sensor…
Thomas
  • 95
  • 1
  • 1
  • 6
9
votes
1 answer

How to detect the hand user holding his device

We are thinking about detecting the hand, user is holding his mobile device, right or left hand or both. As far as our knowledge we think this is not possible with 100% accuracy with the current hardware, we even dont think it would have an accuracy…
mehmet6parmak
  • 4,390
  • 15
  • 46
  • 66
8
votes
1 answer

Android accelerometer, sensor usage and power consumption

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…
8
votes
2 answers

Drawing in air with Android phone

I am working on an application to draw in the air with an android phone. As my phone is moving, thanks to the acceletometer, i retrieve the acceleration on each axis ax, ay, az. What I am interested in is: x,y,z. From what I read in forums and in…
user1068400
  • 115
  • 1
  • 6