Building the interface
To be able to place the call, you need to add three elements to the screen:
- A
TextViewto show the connection status - A
Buttonto start the call - A
Buttonto end the call
Open the app/res/layout/activity_main.xml file. Click the Code button in the top right corner:

Replace the file contents with the following:
You will control the view using code, so you have to store references to the views. Add these properties at the top of the MainActivity class:
private Button startCallButton;
private Button endCallButton;
private TextView connectionStatusTextView;
Now you need to assign views to previously added properties and add callbacks to the buttons. Add below code to the onCreate method inside MainActivity class (below request permissions code):
// init views
startCallButton = findViewById(R.id.startCallButton);
endCallButton = findViewById(R.id.endCallButton);
connectionStatusTextView = findViewById(R.id.connectionStatusTextView);
startCallButton.setOnClickListener(v -> startCall());
endCallButton.setOnClickListener(v -> hangup());
To make code compile add these two empty methods in the MainActivity class:
@SuppressLint("MissingPermission")
private void startCall() {
// TODO: update body
}
private void hangup() {
// TODO: update body
}
You will fill the body of these methods in the following steps of this tutorial.
Build and Run
Run the project again (Ctrl + R).
Notice that buttons are hidden by default:

The state of the connection will be displayed and the START CALL button will be shown after logging in the user.
Making an in-app voice call
You make a voice call from an Android app to a phone.