听在后台服务的音量按钮?音量、后台、按钮

2023-09-11 11:35:28 作者:motor girl.(机车女孩)

我知道如何倾听音量按钮在活动。但我可以做,在后台服务?如果是的话,那怎么办?

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.