Biosopher wrote:
> Our application will expose a Service that can be called by Activities
> in other people's applications. 

Great!

> In many cases, the parent
> applications calling Activity may be paused before our Service
> completes.

It's unclear why that matters.

> (2) Create a PendingIntent to send results back to the activity and
> give it to our Service. Our Service would send data to calling
> Activity's onActivityResult(). Each time the result is delivered, the
> calling Activity will go through onPause() and onResume() but this
> should be OK.

I have never heard of this before. PendingIntent and onActivityResult(),
AFAICT, have as much in common as a banana and belly button lint. Got a
link to something describing this?

> (3) The calling Activities could create a Handler.  The Activity would
> then create a Messenger pointing to that Handler and send it to our
> service. Our Service can then use the Messenger to deliver our message
> back to the calling Activity.

Now that's an intriguing one. I haven't tried that.

> Any other ideas?

(4) Use AIDL. You may already be using AIDL and bindService() to connect
the activities to your remote service. Just have the client implement a
listener object, described via AIDL, and pass the listener object to
your service. Your service calls a method on the listener. See:

http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteClientEx/
http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteServiceEx/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to