服务调用回android中的活动 [英] Service call backs to activity in android

查看:141
本文介绍了服务调用回android中的活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个后台服务正在运行。我有一个客户端与服务交互。



当客户端请求某些操作时,服务执行它,发送结果回活动(客户端)。



我知道如何在活动中调用服务方法,并使用回调,我们可以实现我想做的。但是我不能低估Api示例(remoteservice)中提供的回调机制和代码示例。



任何人都可以给这个服务调用更好的教程或任何

解决方案



如果有帮助,以下是两个示例 < a href =http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteServiceEx/ =nofollow noreferrer>项目显示具有回调的远程客户端/服务。 p>

您也可以使用 broadcast Intents 从服务向客户发送信息。


I have a back ground service running.I have a client which interacts with service.

When the client requests for some operation, the service performs it and it should send the result back to the activity(client).

I know how to invoke the service methods in activity and using call backs we can achieve what I want to do. But I am not able to understa the call back mechanism and code example provided in Api demos(remoteservice).

Can any one give better tutorial on this service call back or any thing which is achievable using simpler mechanism.

Thanku in advance!

解决方案

If it helps, here are two sample projects showing a remote client/service with callbacks.

You can also use broadcast Intents to send information from the service to the client.

这篇关于服务调用回android中的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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