I am creating an app which needs to listen to a (hardware) keypress during a long time period so, I thought that if I lock the screen during that period the phone would save a lot of battery. But some months ago I read something about androids lockscreen.. It was said that during lockscreen, the phone would not be able to listen to hardware keypresses… Am I right?
After this explanation, my question is: Does anyone know any way of listening to a keypress with locked screen in order to not drain a lot of battery?
I thought something about putting screen brightness to its lowest value, but Cpu will be draining battery, because phone is not in deep sleep, so I think this is not the correct way 🙂
any other way, please???
Thanks in advance!!! 😉
you will have to start an infinitely running service to achieve what you are trying to do.
I would like to suggest you a more efficient way to do this, which is making use of ACTION_SCREEN_OFF instead. Good Luck.