views:

7

answers:

0

My app uses the MediaPlayer for audio playback and gives the user the option to switch between AudioManager.STREAM_VOICE_CALL and AudioManager.STREAM_MUSIC (Earphone and SpeakerPhone)

Everything works great on the emulator, HTC Droid Eris, and HTC Incredible. However when we went to test the app on the new HTC G2, the audio was so quiet that it could barely be heard in either mode. Emulators are v1.5 and v2.0.1, Eris is v2.1, Incredible is v2.2, and G2 is v2.2.

When running other apps on the G2, they work just fine. Just my app is quiet (even when the volume is at its highest).

This is the code:

mp = new MediaPlayer();
AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
if (speakerPhoneOn){
 mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
}
else{
 mp.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
}
try {
 mp.setDataSource(path);
 mp.prepare();
} catch (IllegalArgumentException e) {
 e.printStackTrace();
 showDialog(FILE_ERROR_DIALOG);
} catch (IllegalStateException e) {
 e.printStackTrace();
 showDialog(FILE_ERROR_DIALOG);
} catch (IOException e) {
 e.printStackTrace();
 showDialog(FILE_ERROR_DIALOG);
}

Anyone have experience handling device specific problems?

TIA