简体   繁体   中英

Injecting screen_on event to make sensors work when screen is off

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM