Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a phone call with speaker on

brought here is the code for making a phone call from my Activity

public void makeAPhoneCallWithSpeakerOn()
{
  String uri = "tel:" + posted_by.trim() ;
  Intent intent = new Intent(Intent.ACTION_CALL);
  intent.setData(Uri.parse(uri));
  startActivity(intent); 
}

question is:

how can I make the phone call and turn the speaker on?

10X Elad

like image 629
Elad Gelman Avatar asked Oct 10 '22 01:10

Elad Gelman


1 Answers

Use an AudioManager to turn on the speakers and a CallStateListener for receiving the end of the call.

like image 52
Force Avatar answered Oct 22 '22 13:10

Force