Using PhoneStateListener for setting the speaker on

view story

http://stackoverflow.com – I'm using PhoneStateListener so when the user receives a call or starts a call the speaker will be on instantly. PhoneStateListener phoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { if (state == TelephonyManager.CALL_STATE_RINGING) { } else if(state == TelephonyManager.CALL_STATE_IDLE) { AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); audioManager.setSpeakerphoneOn(fals (HowTos)