从 PhoneStateListener 通知服务
我已经构建了一个侦听呼叫状态更改的应用程序,并且我想在 call_state 变为 IDLE 时通知服务。
我拥有的所有组件都可以正常运行,我只需要为此通知(而不是启动)服务。
正确的做法是什么,也许使用 AIDL?
因为,在 PhoneStateListener 中,我无法绑定到服务。我必须为此启动一项活动吗?
I have built an application that listen to call state changes, and I want to notify a service when the call_state became IDLE.
All the components I have are functional, I just need to notify (not start) a service for this.
What's the correct practice, maybe using AIDL?
Because, in a PhoneStateListener, I can't bind to a service. Do I have to start an activity for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你最好向你的服务发送广播意图,而不是尝试绑定它。
I'd think you'd be better off sending your service a broadcast intent than trying to bind to it.
当您想要通知您的服务时,您需要通过 AIDL 调用其进程。
When you want to notify your service you will need to call though to its process via AIDL.