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)
Questions tagged [android-sensors]
1616 questions
215
votes
11 answers
How do I find out if the GPS of an Android device is enabled
On an Android Cupcake (1.5) enabled device, how do I check and activate the GPS?

Marcus
- 8,601
- 4
- 24
- 24
57
votes
8 answers
getSystemServices is undefined when called in a Fragment?
I want TextViews to display the sensors readings in a Fragment. When trying to initialize the SensorManager the getSystemServices is undefined in the Fragment, eclipse says.Why and how to fix it.
Fragment
public class FragSensors extends Fragment…

Amrmsmb
- 1
- 27
- 104
- 226
51
votes
7 answers
How is it possible that Google Fit app measures number of steps all the time without draining battery?
The Google Fit app, when installed, measures the duration you are walking or running, and also the number of steps all the time. However, strangely, using it does not seem to drain the battery. Other apps like Moves which seems to record number of…

Randy Sugianto 'Yuku'
- 71,383
- 57
- 178
- 228
28
votes
5 answers
Android 4.3: BLE: Filtering behaviour of startLeScan()
I'm working on a BluetoothLE sensor device, for which I need to form a one-to-many broadcast of data. As per the spec, peripherals may only have a single master, and due to limitations of the chip and stack I'm designing on, a master can only have…

mattthebaker
- 281
- 1
- 3
- 4
27
votes
4 answers
Turn off screen programmatically when face is close the screen on Android
My app is a dialer and when user holding the phone near his head I need to turn screen off and prevent clicking on the controls - like native Android dialer behavior. What API level I need and how can I do this in right way?

Solkin
- 906
- 1
- 9
- 16
27
votes
4 answers
What's the conceptual difference between rotation vector sensor and orientation sensor in Android?
Android provides both the rotation vector sensor and the orientation sensor. I know they returns different data, because for vector sensor we have sin of angles, in orientation sensor we have angles. But what's the conceptual difference? I can't…

user1781028
- 1,478
- 4
- 22
- 45
26
votes
4 answers
extract yaw, pitch, and roll from a rotationMatrix
I have a sensor manager that returns a rotationMatrix based on the devices Magnetometer and Accelerometer. I have been trying to also calculate the yaw pitch and roll of the user's device but am finding that pitch and roll interfere with each other…

erik
- 4,946
- 13
- 70
- 120
25
votes
1 answer
How can i replace type_orientation (is deprecated) for android 4.0.3?
Hello I want to use the type type_orientation but it is deprecated for the android 4.0.3 . I use it for the augmented reality. I tried to find on the net but without success. My application works but my text inside stay in the same place! Here my…

mhsc90
- 274
- 1
- 3
- 12
24
votes
6 answers
Android Compass that can Compensate for Tilt and Pitch
I'm trying to make a application on my Android phone (Nexus 4), which will be used in a model boat. I've added low pass filters to filter out the gitter from the sensors.
However, the compass is only stable when the phone is flat on its back. If I…

Adam Davies
- 2,742
- 4
- 33
- 52
22
votes
2 answers
What is the difference between "gravity" and "acceleration" sensors in Android?
What is the difference between gravity and acceleration sensors in Android? From my point of view the physical value is the same in both cases.
Which one measures the force acting on unit mass inside the device?
ADDITION
The question is: what…

Suzan Cioc
- 29,281
- 63
- 213
- 385
20
votes
2 answers
How i will detect motion sensor in broadcast receiver?
I had written one receiver to detect device motion is changed or not like this in Manifest.xml

Hanuman
- 958
- 13
- 35
19
votes
1 answer
Android: How to get Google Fit data from Wearable device?
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()
…

user3290180
- 4,260
- 9
- 42
- 77
18
votes
1 answer
Reference coordinate system changes between OpenCV, OpenGL and Android Sensor
I am working with OpenCV, Android and OpenGL for an Augmented Reality project. As far as I know the coordintate system in OpenGL is
The OpenCV coordinate system is:
When combining these devices with android sensors how can I do the coordinate…

Jav_Rock
- 22,059
- 20
- 123
- 164
18
votes
5 answers
How to know if a sensor is present on my Android device?
i would like to know if a sensor (for exemple the accellerometer) is present on my Android device.
I am dealing with the SensorManager class.
Here is the code I am using:
sensorMgr = (SensorManager)…

Milos Cuculovic
- 19,631
- 51
- 159
- 265
18
votes
1 answer
How to make an accurate compass on android
my android application shows the direction of a particular place in the world and therefore in needs to get the compass degree.
This is the code I've been using to calculate the degrees:
public void getDirection() {
mySensorManager =…

eladrich
- 755
- 1
- 5
- 15