on a side note, i recommend the logcat app for such moments http://code.google.com/p/android-random/
On Feb 16, 5:04 pm, Henning Schaefer <[email protected]> wrote: > OK, after digging into the android system code, I think I figured out > what's wrong here... the class "HeadsetObserver" from the base system > actually sends out this intent with its FLAG_RECEIVER_REGISTERED_ONLY > flag set... obviously, there's no way to receive this intent without > implementing a service. > > On 15 Feb., 12:59, Henning Schaefer <[email protected]> > wrote: > > > Hi all, > > > yesterday, I spent several hours trying to figure out how to capture > > the HEADSET_PLUG intent with a BroadcastReceiver. The manifest defines > > the <receiver>, with its intent-filter set to <action > > android:name="android.intent.action.HEADSET_PLUG" />. > > > The receiver is working correctly (I verified that by changing the > > intent filter to capture things like SMS_RECEIVED including the proper > > permissions and the receiver fired as expected on receiving an SMS), > > but when listening for HEADSET_PLUG, it never fires. Debugging the > > whole thing is a bit complicated, as the emulator doesn't seem to > > support headsets and I have to disconnect my target device (a HTC > > Dream) from USB in order to attach a headset (so there's no logfile > > viewing). Are there any special permissions required for applications > > to capture the HEADSET_PLUG intent (and if so, which? I've tried > > several, to no avail)? > > > Maybe the Dream doesn't fire such an intent at all (that'd be bad luck > > for me), but I guess that it must be an issue related to application > > permissions. The documentation says extremely little (well, actually: > > nothing) about the single permissions needed to perform all the > > actions described in the API docs, so this is absolutely something to > > be improved. > > > What I want to do: Upon detecting a headset, I want to re-route the > > ringtones from the speakers to the headset, so as not to annoy people > > in my vicinity by a harsh ringing sound (I'm used to this behaviour > > from my old phone) - by default, the speaker just keeps on ringing, no > > matter whether a headset is attached or not. This part is already > > working, but now I need to know how to detect headset attachment/ > > detachment events. > > > Thanks in advance, > > > Henning --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

