Thursday, December 23, 2010

[android-developers] Detect Intent Broadcast Receivers

Hi,

A similar question has been asked before (with no answers as far as I
can tell), but I thought I'd try my luck: Does anyone know whether
there is a way to know whether there is anyone (anything) out there
listening for a specific type of Intent being broadcast?

There are numerous applications out there that listen for specified
intents, and do something when these intents are broadcast. For
example, "Last.fm Scrobbler" applications. I would like to be able to
tell, from a perferences screen, whether a given intent has a
registered Receiver or not.

This way, if a user chooses a scrobbler application and I detect that
that scrobbler application does not appear to be registered/listening
(or rather, there are no Receivers registered for that type of
Intent), then I display an error/explanation message to the user,
telling them that application is not installed or is disabled.

The closest I've come to this from looking at the Android dev docs is
"sendOrderedBroadcast". If the intended receivers of the broadcast can
be guaranteed to cooperate by doing something predefined to the
payload, then my broadcast receiver at the end should be able to
detect the successful receipt vs lack of Receiver... This relies on a
specific implementation on the part of the expected receivers,
however, so it's not a very general solution.

Any ideas?

Thanks!
Tao

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment