Has anyone else experienced this on the Samsung Galaxy S?
When I use the folowing to turn the Loudspeaker on it works fine:
audioManager.setSpeakerphoneOn(true);
But when I try the opposite to turn it off:
audioManager.setSpeakerphoneOn(false);
The Loudspeaker stays on and audio is played via that instead of the ear piece on the device.
The above works on the Nexus One and HTC Hero, just got a Samsung Galaxy the other day and it doesn't work, has anyone else encountered the issue and perhaps know why it is happening and if there is a work around?
Here's what I have to do to get it to work:
if (isGalaxyS()) {
audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setMode(AudioManager.MODE_NORMAL);
audioManager.setSpeakerphoneOn(flag);
}
Seems that this back and forth somehow resets the audio channel. For completeness here's isGalaxyS() (note that I've only tested this on the Epic!):
public static boolean isGalaxyS() {
String model = Build.MODEL;
return model.equalsIgnoreCase("GT-I9000") || // base model
model.equalsIgnoreCase("SPH-D700") || // Epic (Sprint)
model.equalsIgnoreCase("SGH-I897") || // Captivate (AT&T)
model.equalsIgnoreCase("SGH-T959") || // Vibrant (T-Mobile)
model.equalsIgnoreCase("SCH-I500") || // Fascinate (Verizon)
model.equalsIgnoreCase("SCH-I400"); // Continuum (T-Mobile)
}