远程服务如何将消息发送到绑定的活动? [英] How can a remote Service send messages to a bound Activity?

查看:86
本文介绍了远程服务如何将消息发送到绑定的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读关于绑定服务的文档 ,表明您可以通过消息从活动轻松地与远程服务(即不在同一上下文中)进行通信,但是可以通过任何方式从 Service 发送消息em>绑定到绑定活动?例如,我的活动绑定到同一应用程序的正在运行的后台服务,向该应用程序发送一条消息,并且在接收到此消息后,该服务会向该活动回复一条消息。我如何实现此目的?您能指出一些解释该主题的文档吗?

I've read the documentation about Bound Services, where it is shown that you can easily communicate through Messages from an Activity to a remote (i.e. not in the same context) Service but is there any way to send messages from the Service to the bound Activity? For example, my activity bounds to a running background service of the same application, sends a message to it and upon the reception of this message the service replies with a message to the activity.. how do I implement this? Can you point me to some documentation that explains this topic?

推荐答案

在参考文档中的示例位于远程Messenger服务示例

Found example in the reference documentation at Remote Messenger Service Sample.

这篇关于远程服务如何将消息发送到绑定的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆