更新时间:2023-02-26 21:27:00
原来,我的原始问题"的编辑"中的代码有效,但是我必须重新整理一下一些代码:
It turns out that the code in the Edit of my original question works, but I have to shuffle around some of my code:
Bundle extras = intent.getExtras();
messageHandler = (Messenger) extras.get("MESSENGER");
以上内容需要移到SensorService
的onStartCommand
中,而不是放在BroadcastReceiver
The above needs to be moved to onStartCommand
of SensorService
instead of being in the BroadcastReceiver