我知道如何倾听音量按钮在活动。但我可以做,在后台服务?如果是的话,那怎么办?
I know how to listen to volume buttons in an activity. But can I do that in a background service? If yes, how to do that?
由几个有关此主题的其他问题来看,没有。
Judging by the couple of other questions about this topic, no.
Other问题1 , 其他问题2
服务根本就没有收到KeyEvent的回调。
Services simply do not receive KeyEvent callbacks.