0

I want to find loudspeaker state during call conversation. like speaker state true/ false. my code in call receiver

AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_CALL);
Log.v("Loud_Speaker_state", "" + audioManager.isSpeakerphoneOn());
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
  • What is the error ? Can you add error log if any ? – Nakul Jun 21 '18 at 05:26
  • Hi Nakul, Actually the thing is i need the status of the speaker whether it is in on or Off during the Phone call. my log V/Loud_Speaker_state: false – Bramaramba Jun 21 '18 at 05:53
  • isSpeakerphoneOn() returning correct status. you haven't set it ON. Use this to set it ON audioManager.setSpeakerphoneOn(true); Also add permissions RECORD_AUDIO and MODIFY_AUDIO_SETTINGS – Nakul Jun 21 '18 at 09:45

0 Answers0