PackageManager.queryBroadcastReceivers() returns all receivers declared in
application manifests matching a given Intent.  Note however that this will
not include receivers registered with Context.registerReceiver(); there is
currently no way to get information about those.

On Thu, Dec 23, 2010 at 5:04 PM, Tao <[email protected]> wrote:

> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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