views:

2064

answers:

2

HI,

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 achive wat I wan 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!

+4  A: 

If it helps, here are two sample projects showing a remote client/service with callbacks. And here is a project using a local service and a callback. (NOTE: that URL will be changing in a few days)

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

CommonsWare
A: 

apidemos下的/app/RemoteService & LocalService

Cytown