Skip to main content
Filter by
Sorted by
Tagged with
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....
amol junghare's user avatar
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 ...
Arya's user avatar
  • 1
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 ...
Nicote Ool's user avatar
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 ...
SuhailHasan's user avatar
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 ...
electric_eel23's user avatar
0 votes
2 answers
330 views

watchOS 10 CMBatchedSensorManager, crashes on startDeviceMotionUpdates / startAccelerometerUpdates

I've been waiting to try these APIs. I had already tried them on Beta with no luck and thought on release I would be able to use them. Today I tried with xCode 15 and any calls to start something from ...
Siamaster's user avatar
  • 977
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(), ...
Taimoor Khan's user avatar
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 ...
Harshit Jain's user avatar
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 ...
miral's user avatar
  • 131
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 ...
stardep's user avatar
  • 170
0 votes
1 answer
678 views

How to output temperature using Android Studio

I am trying to develop a simple app that outputs the temperature using a SensorManager to read and set the value from the temperature sensor. But whenever I run the code, nothing outputs, and I get a ...
FireMonkey's user avatar
0 votes
1 answer
744 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 ('...
Martina's user avatar
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 ...
Nikhil's user avatar
  • 1,222
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 ...
AKA's user avatar
  • 318
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: ...
Ribter's user avatar
  • 23
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 ...
R.Agarwal's user avatar
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 ...
tomtom's user avatar
  • 614
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 ...
Marko Vidalis's user avatar
-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 ...
mmt's user avatar
  • 1
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 ...
Cedric's user avatar
  • 970
1 vote
0 answers
148 views

React Native Error: react-native-sensor-manager:compileDebugJavaWithJavac FAILED

I'm trying to use the react-native-sensor-manager in order to get the user steps and count that. But the problem is after I installed this package and did all the configuration as in the documentation....
Hamid Hussainy's user avatar
0 votes
1 answer
150 views

How raw is iOS accelerometry data retrieved through `CMMotionManager`?

Accelerometry data including gravity can be retrieved both on Android and iOS phones: On iOS raw accelerometry data can be retrieved through CMMotionManager. On Android two different types of data ...
Steven Jeuris's user avatar
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" ...
Özgür Ulaş's user avatar
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 ...
Özgür Ulaş's user avatar
0 votes
0 answers
39 views

Detecting complicated motions on the basis of sensory data

I am pretty new in android sensory stuff such as accelerometer, gravity or gyroscope sensors and I hope that maybe here is someone who wants to/can help. Lets say I am trying to detect if a user is ...
Rdn_zaya's user avatar
-1 votes
2 answers
1k views

How to read Android Sensor data only once, when asked for

I'm trying to read the accelerometer and/or geomagnetic sensor in a Java android app to determine the device orientation at one point. But the sensor itself doesn't matter, and my question could be ...
Pierre Rose's user avatar
3 votes
0 answers
949 views

How to detect type of proximity sensor - Infrared or not?

I have an app which relies on using an Infrared based proximity sensor. Since the Note 10, Samsung have been using virtual proximity sensors - that is, they don't use Infrared, but instead rely on a ...
JCutting8's user avatar
  • 764
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 ...
yigit's user avatar
  • 13
0 votes
1 answer
565 views

STEP_COUNTER and STEP_DETECTOR works with SDK 28, but not SDK 29?

I've made a service that regularly broadcasts counted steps from both the STEP_COUNTER and STEP_DETECTOR sensor. In one app I made it worked flawlessly, but after copying the exact same code to ...
Samks's user avatar
  • 96
0 votes
1 answer
744 views

Cannot resolve method 'registerListener(com.xxx.xxx.MainActivity, android.hardware.SensorManager, int)'

couldn't find a good answer to that problem. @Override protected void onResume() { super.onResume(); mSensorManager.registerListener(MainActivity.this, mSensorManager, SensorManager....
Jurek Wiśniewski's user avatar
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 ...
David9809's user avatar
  • 102
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 ...
Mustansar Saeed's user avatar
0 votes
0 answers
67 views

OnSensorChane not being called in some devices

I have tried integrating pedometer. I have came across one issue that onSensorChanges is not being called in specifically ONEPLUS 8 Can any one help ? I am registering listener as below sensorManager....
Vir Rajpurohit's user avatar
3 votes
0 answers
862 views

SensorManager.registerListener - samplingPeriodUs being ignored

Disclaimer: There are many examples of this issue on SO. None of them answer my question. I am trying to make my sensor onSensorChanged event fire every X secods. Here is my code: static long delay1 = ...
pookie's user avatar
  • 4,114
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 ...
john's user avatar
  • 33
2 votes
0 answers
429 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 ...
Paltin Yan's user avatar
2 votes
1 answer
1k views

Android SensorManager vs Google Fit for step count

I've been researching how to read step count in my Android app, and found two completely different ways to do it in the documentation: Using SensorManager: val sensorManager = getSystemService(...
James Allen's user avatar
  • 7,101
0 votes
2 answers
375 views

Converting a class to a service

I have implemented a step counting class that seems to work ok, however I am instantiating it from the main activity and everytime the main activity is loaded another instance of the class is created ...
algorhythm's user avatar
  • 3,416
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 ...
Joonatan Talviste's user avatar
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 ...
Dimitar's user avatar
  • 1,170
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. ...
Elisa's user avatar
  • 13
2 votes
0 answers
165 views

What's the real range of pitch and roll return by SensorManager.getOrientation?

The android doc says: But I test on my android device, the range of pitch is -π/2 to π/2, the range of roll is -π to π. And then I check the source code of SensorManager.getOrientation, I find the ...
wangqi060934's user avatar
  • 1,591
1 vote
2 answers
2k views

Null pointer exception when calling getSystemService on Service class

In my main activity I start a service. In that service, I try to get the sensor manager but I get the following exception Attempt to invoke virtual method 'java.lang.Object android.content....
John's user avatar
  • 468
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 ...
paramjeet singh's user avatar
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 ...
jerboa's user avatar
  • 61
-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 ...
mojojojo's user avatar
  • 177
1 vote
0 answers
416 views

Failed to obtain magnetic field sensor on Pixel 2 despite it exists on sensor list

I tried to get magnetic field sensor with the following code, permission for fine location access has obtained: sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); ...
Gordon W's user avatar
1 vote
2 answers
2k views

Where to poll sensor data in ViewModel environment?

I like to get sensor data (eg. gyroscope) from a fragment using mvvm. So far I got it working but only in a fragment, completely working around the mvvm environment. It doesn't work from the viewmodel ...
gundrabur's user avatar
  • 853
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 ...
Nominalista's user avatar
  • 4,830
1 vote
2 answers
704 views

SensorManager requestTriggerSensor returning false

I am making a fitness app that uses step count to measure distance. I am trying to use the sensorManager.requestTriggerSensor() method to get the initial step count when the app is started. However, ...
Girum A's user avatar
  • 73

1
2 3 4 5