Example: Communication between Activity and Service using Messaging

前端 未结 9 654
既然无缘
既然无缘 2020-11-22 00:06

I couldn\'t find any examples of how to send messages between an activity and a service, and I have spent far too many hours figuring this out. Here is an example project fo

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 00:43

    Look at the LocalService example.

    Your Service returns an instance of itself to consumers who call onBind. Then you can directly interact with the service, e.g. registering your own listener interface with the service, so that you can get callbacks.

提交回复
热议问题