Our application will expose a Service that can be called by Activities
in other people's applications.  In many cases, the parent
applications calling Activity may be paused before our Service
completes.

I am looking for the best way for a Service to communicate back to the
calling Activity that may have been paused.  These are the known
options:

(1) Require calling Activities to have a registerReceiver() with a
custom action and broadcast to that from our Service. The only way to
secure this registerReceiver() is with a signature-based permission.
As our Service communicates with any number of unknown 3rd party apps,
we can't sign our Service's parent app with all these unknown
certificates.  These apps would therefore be exposing an unsecured
registerReceiver() on their Activity.  Would ideally like to avoid
requiring this.

(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.

(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.

Any other ideas?
-- 
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