I am writing my very first android app and have been learning over the
last few days, so bear with me. What I want to do is simple: I am on
conference calls a lot with my Motorola Droid X with a wired headset
that has a mute/unmute button on it. I go on and off mute constantly
but since my Droid screen is off during the call I always have to
light up the screen to see whether I am on mute or not before I start
talking.
So what I want to do is simply listen for MUTE/UNMUTE (doesn't matter
whether or not I have the wired headset plugged in) and when it mutes/
unmutes I want to light up the LED indicator with a Purple (or
whatever) color flashing indicator.
My problem is that I cannot for the life of me figure out, in my
AndroidManifest.xml file, exactly what action I should be listening
for so that my BroadcastReceiver can act on it. I've tried several,
such as "android.intent.action.PHONE_STATE" but that didn't work. For
testing purposes, I know my code is working because I set the action
to "android.net.wifi.WIFI_STATE_CHANGED" and my code fires off when
turning on/off the wifi. So it's just a matter of finding the right
action to listen for. Any help?
Code from AndroidManifest.xml:
---------------------------------
<receiver android:name="MuteIntentReceiver">
<intent-filter>
<action
android:name="android.net.wifi.WIFI_STATE_CHANGED" />
</intent-filter>
</receiver>
---------------------------------
Code from MuteIntentReceiver.java:
---------------------------------
public class MuteIntentReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
AudioManager audioMgr = (AudioManager)
context.getSystemService(Context.AUDIO_SERVICE);
if (audioMgr.isMicrophoneMute())
{
// code goes here
}
else
{
// code goes here
}
}
}
---------------------------------
--
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