Detection if the phone is in your pocket or not

This question concerns not only the code, but also the implementation.

I am working on an application that requires checking if the phone is in my pocket or not. I have a simple algorithm for detecting user steps when walking. The problem is that the movement in the hand can also be recorded as a step, for example. when the user launches the application and zeros of the step value from the moment when he does it to such an extent that the phone is in his pocket, the application registers several steps.

My idea is to check the proximity sensor and see if the phone is in your pocket.

What I do with the accelerometer sensor is that I continue to read the values ​​of the accelerometer in the buffer, when the buffer is full, then I calculate the steps (when calculating the buffer, new accelerometer readings are still accepted).

Since I heard that the proximity sensor is interrupt based and not poll based (like acc sensor). How can I copy these two together?

Can I say if I check the proximity before writing the acc values ​​to the buffer and try again when the calculation starts, if the proximity was not in FAR mode, can I assume that the phone was in my pocket?

Any suggestion is welcome!

+7
android proximitysensor proximity
source share

No one has answered this question yet.

See similar questions:

0
Detect device in pocket

or similar:

1002
Grid motion detection
60
Internal positioning system based on gyroscope and accelerometer
eleven
How to calculate distance based on phone acceleration
one
Detect when sound is played through the speaker speaker
one
The problem with freezing the proximity sensor on Android M Preview 3
one
How can I get a phone call using the sensor with my android application?
0
Disable proximity sensor after closing the application - Android
0
Proximity Sensor- Silence Application
0
Set your proximity sensor threshold distance on Android phones
0
Android proximity sensor [Unique problem - the sensor does not detect objects already near the phone]

All Articles