How to establish a two-way communication between Activity and Service in different process?
Posted
by steff
on Stack Overflow
See other posts from Stack Overflow
or by steff
Published on 2010-03-19T08:58:16Z
Indexed on
2010/03/19
9:01 UTC
Read the original article
Hit count: 363
Hi everyone,
I'm working on establishing a two-way communication between an Activity and a Service which runs in a different process.
Querying the process from the Activity is no big deal. But I want the process to notify the Activity on events. The idea behind it is this: the service runs independently from the actual app. It queries a webserver periodically. If a new task is found on the webserver the process should notify the activity.
I found this thread over at AndDev.org but it doesn't seem to work for me. I've been messing around with BroadcastReceiver. I've implemented an interface which should notify the Activity but the problem is that the listener is always null since the Broadcast from the process is done via Intent, hence the class that extends BroadcastReceiver will be newly instantiated.
How can I establish a 2-way communication? This has to be possible. Thanks for any help,
steff
© Stack Overflow or respective owner