Android APIs
public final class

Call

extends Object
java.lang.Object
   ↳ android.telecom.Call

Class Overview

Represents an ongoing phone call that the in-call app should present to the user.

Summary

Nested Classes
class Call.Callback  
class Call.Details  
Constants
String AVAILABLE_PHONE_ACCOUNTS The key to retrieve the optional PhoneAccounts Telecom can bundle with its Call extras.
int STATE_ACTIVE The state of a Call when actively supporting conversation.
int STATE_CONNECTING The initial state of an outgoing Call.
int STATE_DIALING The state of an outgoing Call when dialing the remote number, but not yet connected.
int STATE_DISCONNECTED The state of a Call when no further voice or other communication is being transmitted, the remote side has been or will inevitably be informed that the Call is no longer active, and the local data transport has or inevitably will release resources associated with this Call.
int STATE_DISCONNECTING The state of a Call when the user has initiated a disconnection of the call, but the call has not yet been disconnected by the underlying ConnectionService.
int STATE_HOLDING The state of a Call when in a holding state.
int STATE_NEW The state of a Call when newly created.
int STATE_RINGING The state of an incoming Call when ringing locally, but not yet connected.
int STATE_SELECT_PHONE_ACCOUNT The state of an outgoing Call when waiting on user to select a PhoneAccount through which to place the call.
Public Methods
void answer(int videoState)
Instructs this STATE_RINGING Call to answer.
void conference(Call callToConferenceWith)
Instructs this Call to enter a conference.
void disconnect()
Instructs this Call to disconnect.
List<String> getCannedTextResponses()
Obtains a list of canned, pre-configured message responses to present to the user as ways of rejecting this Call using via a text message.
List<Call> getChildren()
Obtains the children of this conference Call, if any.
List<Call> getConferenceableCalls()
Returns the list of Calls with which this Call is allowed to conference.
Call.Details getDetails()
Obtains an object containing call details.
Call getParent()
Obtains the parent of this Call in a conference, if any.
String getRemainingPostDialSequence()
Obtains the post-dial sequence remaining to be emitted by this Call, if any.
int getState()
Obtains the state of this Call.
InCallService.VideoCall getVideoCall()
Obtains an object that can be used to display video from this Call.
void hold()
Instructs this Call to go on hold.
void mergeConference()
Merges the calls within this conference.
void phoneAccountSelected(PhoneAccountHandle accountHandle, boolean setDefault)
Notifies this Call that an account has been selected and to proceed with placing an outgoing call.
void playDtmfTone(char digit)
Instructs this Call to play a dual-tone multi-frequency signaling (DTMF) tone.
void postDialContinue(boolean proceed)
Instructs this Call to continue playing a post-dial DTMF string.
void registerCallback(Call.Callback callback)
Registers a callback to this Call.
void registerCallback(Call.Callback callback, Handler handler)
Registers a callback to this Call.
void reject(boolean rejectWithMessage, String textMessage)
Instructs this STATE_RINGING Call to reject.
void splitFromConference()
Instructs this Call to split from any conference call with which it may be connected.
void stopDtmfTone()
Instructs this Call to stop any dual-tone multi-frequency signaling (DTMF) tone currently playing.
void swapConference()
Swaps the calls within this conference.
void unhold()
Instructs this STATE_HOLDING call to release from hold.
void unregisterCallback(Call.Callback callback)
Unregisters a callback from this Call.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String AVAILABLE_PHONE_ACCOUNTS

Added in API level 23

The key to retrieve the optional PhoneAccounts Telecom can bundle with its Call extras. Used to pass the phone accounts to display on the front end to the user in order to select phone accounts to (for example) place a call.

Constant Value: "selectPhoneAccountAccounts"

public static final int STATE_ACTIVE

Added in API level 23

The state of a Call when actively supporting conversation.

Constant Value: 4 (0x00000004)

public static final int STATE_CONNECTING

Added in API level 23

The initial state of an outgoing Call. Common transitions are to STATE_DIALING state for a successful call or STATE_DISCONNECTED if it failed.

Constant Value: 9 (0x00000009)

public static final int STATE_DIALING

Added in API level 23

The state of an outgoing Call when dialing the remote number, but not yet connected.

Constant Value: 1 (0x00000001)

public static final int STATE_DISCONNECTED

Added in API level 23

The state of a Call when no further voice or other communication is being transmitted, the remote side has been or will inevitably be informed that the Call is no longer active, and the local data transport has or inevitably will release resources associated with this Call.

Constant Value: 7 (0x00000007)

public static final int STATE_DISCONNECTING

Added in API level 23

The state of a Call when the user has initiated a disconnection of the call, but the call has not yet been disconnected by the underlying ConnectionService. The next state of the call is (potentially) STATE_DISCONNECTED.

Constant Value: 10 (0x0000000a)

public static final int STATE_HOLDING

Added in API level 23

The state of a Call when in a holding state.

Constant Value: 3 (0x00000003)

public static final int STATE_NEW

Added in API level 23

The state of a Call when newly created.

Constant Value: 0 (0x00000000)

public static final int STATE_RINGING

Added in API level 23

The state of an incoming Call when ringing locally, but not yet connected.

Constant Value: 2 (0x00000002)

public static final int STATE_SELECT_PHONE_ACCOUNT

Added in API level 23

The state of an outgoing Call when waiting on user to select a PhoneAccount through which to place the call.

Constant Value: 8 (0x00000008)

Public Methods

public void answer (int videoState)

Added in API level 23

Instructs this STATE_RINGING Call to answer.

Parameters
videoState The video state in which to answer the call.

public void conference (Call callToConferenceWith)

Added in API level 23

Instructs this Call to enter a conference.

Parameters
callToConferenceWith The other call with which to conference.

public void disconnect ()

Added in API level 23

Instructs this Call to disconnect.

public List<String> getCannedTextResponses ()

Added in API level 23

Obtains a list of canned, pre-configured message responses to present to the user as ways of rejecting this Call using via a text message.

Returns
  • A list of canned text message responses.

public List<Call> getChildren ()

Added in API level 23

Obtains the children of this conference Call, if any.

Returns
  • The children of this Call if this Call is a conference, or an empty List otherwise.

public List<Call> getConferenceableCalls ()

Added in API level 23

Returns the list of Calls with which this Call is allowed to conference.

Returns
  • The list of conferenceable Calls.

public Call.Details getDetails ()

Added in API level 23

Obtains an object containing call details.

Returns
  • A Call.Details object. Depending on the state of the Call, the result may be null.

public Call getParent ()

Added in API level 23

Obtains the parent of this Call in a conference, if any.

Returns
  • The parent Call, or null if this Call is not a child of any conference Calls.

public String getRemainingPostDialSequence ()

Added in API level 23

Obtains the post-dial sequence remaining to be emitted by this Call, if any.

Returns
  • The remaining post-dial sequence, or null if there is no post-dial sequence remaining or this Call is not in a post-dial state.

public int getState ()

Added in API level 23

Obtains the state of this Call.

Returns
  • A state value, chosen from the STATE_* constants.

public InCallService.VideoCall getVideoCall ()

Added in API level 23

Obtains an object that can be used to display video from this Call.

Returns
  • An Call.VideoCall.

public void hold ()

Added in API level 23

Instructs this Call to go on hold.

public void mergeConference ()

Added in API level 23

Merges the calls within this conference. See CAPABILITY_MERGE_CONFERENCE.

public void phoneAccountSelected (PhoneAccountHandle accountHandle, boolean setDefault)

Added in API level 23

Notifies this Call that an account has been selected and to proceed with placing an outgoing call. Optionally sets this account as the default account.

public void playDtmfTone (char digit)

Added in API level 23

Instructs this Call to play a dual-tone multi-frequency signaling (DTMF) tone. Any other currently playing DTMF tone in the specified call is immediately stopped.

Parameters
digit A character representing the DTMF digit for which to play the tone. This value must be one of '0' through '9', '*' or '#'.

public void postDialContinue (boolean proceed)

Added in API level 23

Instructs this Call to continue playing a post-dial DTMF string. A post-dial DTMF string is a string of digits entered after a phone number, when dialed, that are immediately sent as DTMF tones to the recipient as soon as the connection is made. If the DTMF string contains a DTMF_CHARACTER_PAUSE symbol, this Call will temporarily pause playing the tones for a pre-defined period of time. If the DTMF string contains a DTMF_CHARACTER_WAIT symbol, this Call will pause playing the tones and notify callbacks via onPostDialWait(Call, String). At this point, the in-call app should display to the user an indication of this state and an affordance to continue the postdial sequence. When the user decides to continue the postdial sequence, the in-call app should invoke the postDialContinue(boolean) method.

Parameters
proceed Whether or not to continue with the post-dial sequence.

public void registerCallback (Call.Callback callback)

Added in API level 23

Registers a callback to this Call.

Parameters
callback A Callback.

public void registerCallback (Call.Callback callback, Handler handler)

Added in API level 23

Registers a callback to this Call.

Parameters
callback A Callback.
handler A handler which command and status changes will be delivered to.

public void reject (boolean rejectWithMessage, String textMessage)

Added in API level 23

Instructs this STATE_RINGING Call to reject.

Parameters
rejectWithMessage Whether to reject with a text message.
textMessage An optional text message with which to respond.

public void splitFromConference ()

Added in API level 23

Instructs this Call to split from any conference call with which it may be connected.

public void stopDtmfTone ()

Added in API level 23

Instructs this Call to stop any dual-tone multi-frequency signaling (DTMF) tone currently playing. DTMF tones are played by calling playDtmfTone(char). If no DTMF tone is currently playing, this method will do nothing.

public void swapConference ()

Added in API level 23

Swaps the calls within this conference. See CAPABILITY_SWAP_CONFERENCE.

public void unhold ()

Added in API level 23

Instructs this STATE_HOLDING call to release from hold.

public void unregisterCallback (Call.Callback callback)

Added in API level 23

Unregisters a callback from this Call.

Parameters
callback A Callback.