Injecting screen_on event to make sensors work when screen is off

独自空忆成欢 提交于 2019-12-05 02:38:37

问题


I am trying to make sensors work when screen is off. It is well known bug. And there is no any soution for this on all phones. I have the hypothesis that i can can cheat kernel if I send(inject) screen_on event while actually the screen will be turned off. Do you have any ideas how can i check my hypothesis and inject such event?


回答1:


Why don't you start a background service that monitors the sensors?

And then send/use the results back to your application's activities. Your activity will still pause when screen goes off, but you will continue to read the sensor data.

Also a good idea to do the heavy processing the background service as well...

This works great for me.



来源:https://stackoverflow.com/questions/11987510/injecting-screen-on-event-to-make-sensors-work-when-screen-is-off

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!