I develop basic radio stream application with service.After incoming call , radio stream continue but sound play top speaker.I want to play it from all speaker.How to do this ?
Asked
Active
Viewed 79 times
0
-
You should show some code, otherwise we wont be able to help you. – Robin Ellerkmann Nov 06 '14 at 12:25
1 Answers
0
private final PhoneStateListener phoneListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
try {
switch (state) {
case TelephonyManager.CALL_STATE_RINGING: {
//PAUSE
if(BackgroundAudioService.mediaPlayer!=null){
BackgroundAudioService.mediaPlayer.pause();}
Log.i("pause","pause");
break;
}
case TelephonyManager.CALL_STATE_OFFHOOK: {
break;
}
case TelephonyManager.CALL_STATE_IDLE: {
//PLAY
if(BackgroundAudioService.mediaPlayer!=null){
BackgroundAudioService.mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
BackgroundAudioService.mediaPlayer.start();
Log.i("play","play");
}
break;
}
default: { }
}
} catch (Exception ex) {
}
}
};