I want to identify if the Sensor used for Activity Recognition works when device screen is off.
Activity Recognition stops as soon as Device screen is turned OFF. I searched for it and found that sensor does not work when screen is OFF to save the battery.
So there is a method to identify such sensors by isWakeUpSensor(), but isWakeUpSensor() is applicable from API 21.
How can I make it work on API 14 onward. Identify sensor before starting Activity Recognition. Same as application "Moves" does
After a little bit of searching I found this documentation which states
Up to KitKat, whether a sensor was a wake-up or a non-wake-up sensor was dictated by the sensor type: most were non-wake-up sensors, with the exception of the proximity sensor and the significant motion detector.
On the other hand, the significant motion detector page says
Implement only the wake-up version of this sensor.
getDefaultSensor(SENSOR_TYPE_SIGNIFICANT_MOTION)
returns a non-wake-up sensor
which confuses me. It is, however, a composite sensor, which means that it's wake-up-ness depends on the underlying actual sensors (I would imagine).
More research into this suggests that significant motion detector was added in Android 4.3 (API 18), so you're left with the proximity sensor for available wake-up sensors in API 14 devices, which is primarily intended to be used to turn the screen on and off when making phone calls.
Seems to me like there is no way to do exactly what you have in mind without a wake lock.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With