All Questions
Tagged with sensormanager android-sensors
127 questions
0
votes
0
answers
15
views
Calculate angle in device when the device is held vertically
I want to calculate the angle between 0 to 45 degree when the device is held vertically (i.e., against a wall, with the bottom edge flat on a table).When tilt to right side it will captures the angle....
0
votes
0
answers
50
views
Read Data from external Sensors
I would like to create an android app which monitors the room temperature.
Is it possible to connect a temperature sensor with cable (I do not want to be dependent on Wi-Fi and if possible not on ...
0
votes
0
answers
33
views
There is a way to know if other application is using a sensor [Android]
I´m working in a POC in Android and I need to know if another application is using a sensor (moreover if it is starting or shutting down a sensor).
Do you know if SensorManager does that?
Perhaps ...
0
votes
0
answers
58
views
How to measure radiation(Non Ionizing) [Android SDK] for a Radiation measuring application
I need a way to measure the non-ionizing radiation around me through the smart phones. I have found several applications on the google Play Store which have an RF meter functionality which measures ...
0
votes
0
answers
130
views
I can't get the ambient temperature on my phone
I am building an app which shoud display all the values from all the sensors including the TYPE_AMBIENT_TEMPERATURE sensor. I am using the SensorManager class.
I have written the code and tested it on ...
0
votes
1
answer
59
views
Memory leak in SensorManager implementation in parent class
I have handled screen orientation using SensorManager and it's working fine
But there is some memory leak as it is set in BaseActivity like
abstract class BaseActivity : AppCompatActivity(), ...
1
vote
1
answer
391
views
How to apply calibration to accelerometer in android?
I am using rotation vector sensor to calculate the orientation of my device. There seems to be an error in the output of rotation vector sensor due to some offset in accelerometer data. I am able to ...
0
votes
1
answer
252
views
sensor TYPE_STEP_DETECTOR is not working when screen is off
in my app i use the TYPE_STEP_DETECTOR. I want to detect steps when screen is off. But the sensor TYPE_STEP_DETECTOR does not work when the screen is off. So I use PowerManager/WakeLock to make the ...
0
votes
0
answers
114
views
Unresolved reference: getSensorList in SensorManager.getSensorList
I am writing a simple code to find out all available sensors in an Android System.
I don't know why I am getting this error. Neither Android docs have mentioned any exception as such that may occur ...
0
votes
1
answer
745
views
Step Counter in Android Studio doesn't count steps
I have a problem with an app I'm trying to develop in Android Studio. I'm trying to develop a step counter using the STEP_COUNTER sensor in a Fragment.I decided to show my results in a TextView ('...
0
votes
0
answers
39
views
Is it possible to send data to light sensor in android?
I am working with sensors in my application in which I got stuck on a question is there any way to send data through the light sensor or to the light sensor in android programmatically?
Any help will ...
0
votes
0
answers
226
views
Background Service implementing SeneorEventListener only fires once; used to work well a few years ago
I'm resurrecting an old app I wrote that wakes up once every minute and logs my phone's orientation.
The issue I'm observing now, which is different from when the code was written circa 2015, is that ...
1
vote
0
answers
114
views
TYPE_STEP_COUNTER sensor not found on a real device(Android Studio)
Hello I`m doing step counter.
In manifest I added the permission
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
I also added a check in the onCreate method:
...
0
votes
0
answers
122
views
Android: Sensor delay in SensorEventListener is working differently for different devices(from different manufacturers)
In Oppo mobile phone gyroscope is giving twice the accelerometer data(no of data per time period). In oneplus it is giving 5 times and in MI phone it perfectly giving the same no of data for both ...
0
votes
1
answer
139
views
How to read only once from Android build in Accelerometer per second?
With help of sensorManager I am reading accelerometer reading. Currently slowest setting ie SENSOR_DELEY_NORMAL ,accelerometer reads around 10 times every second. Is there any way by which it can ...
0
votes
1
answer
624
views
Starting a service that records sensor data in Kotlin Android App
I'm creating an android app which uses a telematics SDK to start recording driving activity when the SDK picks up that the user is driving. The SDK runs in the background, and has full access to ...
-2
votes
1
answer
1k
views
Java - Android - Pedometer Doesn't count steps when the app is running in the background
My problem is that my pedometer only counts the steps when I have the app open.
As soon as I leave the app, it stops counting.
The goal of the Android app is that the steps are counted as long as the ...
6
votes
1
answer
2k
views
Flutter: how can I permanently register a sensor (and never unregister it?)
TL;DR how can I have an Android sensor permanently running/active/registered for my app, even if I close it?
Objective:
I'm making a Flutter application that counts your steps using the pedometer ...
2
votes
0
answers
1k
views
Android/Kotlin: onKeyDown function is not working and fired
I wanted to calculate the screen touch time.
I used the "onKeyUp" function when my finger was not on the screen and "isKeyPressed" returned false.I used the "onKeyDown" ...
0
votes
1
answer
241
views
Android- Kotlin: how can i measure and detect covered area by a finger touch on screen
I want to know how much area my finger covers when I touch the phone screen.
I used many sensors for some events. I compile my code with Android Studio. They asked this question 11 years ago but the ...
1
vote
1
answer
629
views
TYPE_STEP_COUNTER sensor not found in NEXUS5X 29API
I am doing a step counter project in an android studio with Nexus5X API29. I need to use sensors for this. I wrote the sensor codes as below, but it still gives 'Sensor not found' error. Is there any ...
0
votes
2
answers
380
views
Simple stepCounter doesn't work on different phones
I made simple stepCounter based on step counter sensor. I know that not everyone phone have this kind of sensor, so I've secured my code by Toast message in onResume.Both devices showing Toast Message ...
0
votes
1
answer
477
views
Detect if user is indoor or outdoor using mobile sensors
I am trying to detect whether user is indoor or outdoor using Acceleromter, magnetic field and light sensor. I am using the following method:
Registering the Sensor Manager
@Override
protected ...
3
votes
1
answer
2k
views
Why doesn't my SensorEventListener implementation work? Not receiving onSensorChanged callbacks
I'm trying to make an app to display phones roation in degrees, but onSensorChanged is not getting called. The text in the textView isn't changing and I don't know why. It doesn't give any compile ...
2
votes
0
answers
430
views
Android steps counter sensor is updated only if application is in focus on some devices
I'm developing steps counter application on Android.
To get the steps the application is listening to onSensorChanged(..) event of Sensor.TYPE_STEP_COUNTER sensor.
The problem is that on some devices ...
0
votes
2
answers
127
views
rephrase definition for android orientation angle "roll"
The definition of 'roll' in android is:
angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground
See here.
Maybe I'm missing something, but there seem ...
1
vote
2
answers
669
views
How to collect data from multiple mobile sensors at once in Java?
I want to collect data from the accelerometer, gyroscope and magnetometer all at once. I am currently using the SensorManager service which is based on the SensorEvent. The problem with this is that I ...
1
vote
1
answer
1k
views
How can I access the heart rate sensor of my Huawei Watch 2 if it is not an original Huawei Sensor?
I bought a Huawei Watch 2 because I'm working on an app that reads steps and heart rate.
Before opting for the Google Fitness API, I wanted to try accessing raw data directly from the watch sensors.
...
1
vote
0
answers
1k
views
How to calculate time calories burnt while counting steps using STEP_COUNT_SENSOR
I am new to android and working on an application like pedometer. I have calculated total steps using Step Count Sensor , Now I want to calculate total time and calories burnt. Step count sensor ...
1
vote
1
answer
445
views
How to convert the magnetic field vector from sensor coordinate space to camera coordinate space?
I would like to collect the magnetic field vector (i.e. x,y,z in microteslas) from the TYPE_MAGNETIC_FIELD Position sensor and put it in the same coordinate system that the Frame's we get from ARCore ...
-2
votes
1
answer
248
views
Displaying multiple sensors readings on screen
I am trying to display multiple sensor readings on screen (accelerometer, magnetometer, etc.) in its own line of text. I can change the text onscreen for one type of sensor (accelerometer), but not ...
1
vote
0
answers
407
views
Why roll is unpredictable when pitch is close to 90 degrees?
While playing with Sensor Manager, I noticed that sensor data has some limitations that I cannot understand.
By listening for sensor events, we can extract azimuth, pitch and roll values. Here is ...
0
votes
1
answer
1k
views
Android step counter
I am trying to make a simple Android application to count steps. When I run the application the else is called in the onResume method meaning it did not find the sensor. I am testing on a 2016 Samsung ...
0
votes
1
answer
311
views
SensorManager only working on some devices
I have the following code to get the x and y angle of my device and it is working fine on my phone, but not my tablet (Samsung galaxy tab e). I was wondering if anyone had any idea as to what could be ...
2
votes
0
answers
670
views
Check any sensor availability in Android: PackageManager vs SensorManager
I was reading about Sensors in Android and ways how to check their availability on the device. But I faced with kind of contradiction.
Official Android Guide says that one should use SensorManager as ...
0
votes
1
answer
128
views
Averaging sensor data over a small time period or just picking a few values in a small time period
I am working on an Android app that collect accelerometer data. It detects way too much data in the onSensorChanged() listener and I found out that you cannot really set a sampling rate (you can ...
1
vote
0
answers
117
views
Android How to get amplitude for different frequencies with the help of SensorEvent
I want to calculate vibration while vehicle is moving. I am getting this data in onSensorChanged event. I need to calculate vibration for 12hz, 24hz and 36hz.
@Override
public void ...
0
votes
1
answer
1k
views
Detect device moving detail
I am doing a demo in which when I move device like on top-left, top-right,top-center and bottom-right, bottom-left, bottom-center, center-right, center-left this type of movement I need to detect so ...
0
votes
0
answers
239
views
How to record data from several sensors in an android phone in Android Studio?
I know that you have to use this code to register your listener for you sensor, say, Accelerometer:
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_FASTEST);
What if ...
2
votes
1
answer
309
views
Android HAL makes system stuck in poll() function
We are working on custom development board and currently, we are implementing "Sensor HAL" on Android 7.1.
We have implemented "Sensor HAL" APIs as per Android sensor service requirement(sensor.h) ...
2
votes
2
answers
2k
views
Android SensorManager does not update SensorList after acquiring BODY_SENSORS permission in runtime
I'm working with Heart Rate sensor on Samsung S6. In order access this sensor, starting from SDK Version > 23, BODY_SENSORS permission must be granted by the user https://stackoverflow.com/a/32636039/...
1
vote
0
answers
56
views
Sensor stop collecting when the watch is not charged
I'm writing a simple data logging app that collects accel, gyroscope and write to csv.
It seems that when the watch is on the dock for charging, it works fine. When it's removed from the dock and ...
0
votes
0
answers
183
views
How to get values from Step Counter without any events?
I am writing an app and I need to get Step Counters value at the start of the app. I don't need to wait for the first step to be made. I want it right at the start. Is it possible to do it?
1
vote
1
answer
281
views
continuous getting shake signal in android
I created one class for shake detection and one for shake service to act when shake is detected. When I run the service, I m continuously shake signal. Can some one guide where is the issue.
Shake ...
5
votes
0
answers
321
views
Appcelerator Hyperloop Android - How to use certain Sensor Manager functions which use a pass by reference structure
I'm stepping into Hyperloop for the first time, specifically for Android currently, and although it's going fairly well I've had one issue which I will explain below.
I've successfully been able to ...
-2
votes
1
answer
808
views
Android - Launching an app with a shake
I'm a newbie to this field of android development. I'm developing an app which I need to be launched by shaking the device. How can I get this thing done? I read many threads and tried out several ...
-1
votes
1
answer
938
views
How to get CPU temperature and CPU & RAM usage?
I am developing an application and I do not know how I can get the CPU usage and temperature, example in a textview. I try with TYPE_AMBIENT_TEMPERATURE to get temperature, but it does not work. The ...
0
votes
1
answer
190
views
Delayed (timed) unregister sensor listener inside IntentService (WakefulIntentService)
I've implemented an IntentService which, using SensorManager, reads data from a heart rate sensor.
It gets periodically called using AlarmManager and a WakefulBroadcastReceiver and then, upon ...
0
votes
1
answer
743
views
Proximity Sensor in Android does not respond
I am trying to build a simple Android application which updates the text of a textview when the proximity sensor values change. However the textview values remain the same despite bringing an object ...
0
votes
1
answer
129
views
Android:Why not use TYPE_GRAVITY data in getRotationMatrix(float[] R, float[] I, float[] gravity, float[] geomagnetic)?
gravity is an array of 3 floats containing the gravity vector expressed in the device's coordinate. You can simply use the values returned by a SensorEvent of a Sensor of type TYPE_ACCELEROMETER. This ...