Android: get current sensor status

Yes, I can receive sensor update events using SensorEventListener. But this approach has 2 files:

1) For some sensors, I need to wait for the status update. For example, the temperature can be updated in a minute!

2) In some cases, I may receive incorrect readings. For example, the phone lies on a flat surface and does not move. I get the first orientation update event after registering the listener. When only part of the orientation vector changes, the other parts can be 0. And this is not a way to determine if it is a true azimuth of 0 degrees or just an incomplete vector. If I outweigh the phone a little, the correct non-zero azimuth will appear.

To solve this problem, you can create a separate thread that constantly monitors the sensors. After some time, it will necessarily contain true values. But I believe that this is not an easy task for such a simple task.

Is there any other way to get the current sensor data?

+3
source share
1 answer

Is there any other way to get the current sensor data?

Not in the current API, AFAIK, sorry.

+3
source

Source: https://habr.com/ru/post/1731776/


All Articles