View Single Post
Old November 10th, 2012, 06:27 PM   #1 (permalink)
New Member
Thread Author (OP)
Join Date: Nov 2012
Posts: 1
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default How do you use ACTION_HEADSET_PLUG?

I am working on an android application and I want to detect whether the headset is plugged in or not. I found the ACTION_HEADSET_PLUG thing, but I don't understand how to use it, and everything I have tried has not worked yet.

I tried adding
<receiver android:enabled="true" android:name=".AudioJackReceiver" >
<action android:name="android.intent.action.HEADSET_PLUG" >

To my manifest, and I made a class that extends BroadcastReceiver in my package, but it doesn't seem to be called.
Do I need to add a special permission to my manifest? Can anyone point me to a sample application that uses this? I couldn't find anything in ApiDemos.

Any help would be appreciated

bluebrian is offline  
Reply With Quote