Call.Callback


public static abstract class Call.Callback
extends Object

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


Defines callbacks which inform the InCallService of changes to a Call. These callbacks can originate from the Telecom framework, or a ConnectionService implementation.

You can handle these callbacks by extending the Callback class and overriding the callbacks that your InCallService is interested in. The callback methods include the Call for which the callback applies, allowing reuse of a single instance of your Callback implementation, if desired.

Use Call#registerCallback(Callback) to register your callback(s). Ensure Call#unregisterCallback(Callback) is called when you no longer require callbacks (typically in InCallService#onCallRemoved(Call)). Note: Callbacks which occur before you call Call#registerCallback(Callback) will not reach your implementation of Callback, so it is important to register your callback as soon as your InCallService is notified of a new call via InCallService#onCallAdded(Call).

Summary

Constants

int HANDOVER_FAILURE_DEST_APP_REJECTED

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when the app to handover the call to rejects the handover request.

int HANDOVER_FAILURE_NOT_SUPPORTED

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when a handover is initiated but the source or destination app does not support handover.

int HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when there is ongoing emergency call.

int HANDOVER_FAILURE_UNKNOWN

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when a handover fails for an unknown reason.

int HANDOVER_FAILURE_USER_REJECTED

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when the remote user rejects the handover request.

Public constructors

Callback()

Public methods

void onCallDestroyed(Call call)

Invoked when the Call is destroyed.

void onCannedTextResponsesLoaded(Call call, List<String> cannedTextResponses)

Invoked when the text messages that can be used as responses to the incoming Call are loaded from the relevant database.

void onChildrenChanged(Call call, List<Call> children)

Invoked when the children of this Call have changed.

void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls)

Invoked upon changes to the set of Calls with which this Call can be conferenced.

void onConnectionEvent(Call call, String event, Bundle extras)

Invoked when a Call receives an event from its associated Connection or Conference.

void onDetailsChanged(Call call, Call.Details details)

Invoked when the details of this Call have changed.

void onHandoverComplete(Call call)

Invoked when Call handover from one PhoneAccount to other PhoneAccount has completed successfully.

void onHandoverFailed(Call call, int failureReason)

Invoked when Call handover from one PhoneAccount to other PhoneAccount has failed.

void onParentChanged(Call call, Call parent)

Invoked when the parent of this Call has changed.

void onPostDialWait(Call call, String remainingPostDialSequence)

Invoked when the post-dial sequence in the outgoing Call has reached a pause character.

void onRttInitiationFailure(Call call, int reason)

Invoked when the RTT session failed to initiate for some reason, including rejection by the remote party.

void onRttModeChanged(Call call, int mode)

Invoked when the RTT mode changes for this call.

void onRttRequest(Call call, int id)

Invoked when the remote end of the connection has requested that an RTT communication channel be opened.

void onRttStatusChanged(Call call, boolean enabled, Call.RttCall rttCall)

Invoked when the call's RTT status changes, either from off to on or from on to off.

void onStateChanged(Call call, int state)

Invoked when the state of this Call has changed.

void onVideoCallChanged(Call call, InCallService.VideoCall videoCall)

Invoked when the Call.VideoCall of the Call has changed.

Inherited methods

Constants

HANDOVER_FAILURE_DEST_APP_REJECTED

Added in API level 28
public static final int HANDOVER_FAILURE_DEST_APP_REJECTED

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when the app to handover the call to rejects the handover request.

Will be returned when Call#handoverTo(PhoneAccountHandle, int, Bundle) is called and the destination PhoneAccountHandle's ConnectionService returns a null Connection from ConnectionService#onCreateOutgoingHandoverConnection(PhoneAccountHandle, ConnectionRequest).

For more information on call handovers, see Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle).

Constant Value: 1 (0x00000001)

HANDOVER_FAILURE_NOT_SUPPORTED

Added in API level 28
public static final int HANDOVER_FAILURE_NOT_SUPPORTED

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when a handover is initiated but the source or destination app does not support handover.

Will be returned when a handover is requested via Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle) and the destination PhoneAccountHandle does not declare PhoneAccount#EXTRA_SUPPORTS_HANDOVER_TO. May also be returned when a handover is requested at the PhoneAccountHandle for the current call (i.e. the source call's Details#getAccountHandle()) does not declare PhoneAccount#EXTRA_SUPPORTS_HANDOVER_FROM.

For more information on call handovers, see Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle).

Constant Value: 2 (0x00000002)

HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL

Added in API level 28
public static final int HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when there is ongoing emergency call.

This error code is returned when Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle) is called on an emergency call, or if any other call is an emergency call.

Handovers are not permitted while there are ongoing emergency calls.

For more information on call handovers, see Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle).

Constant Value: 4 (0x00000004)

HANDOVER_FAILURE_UNKNOWN

Added in API level 28
public static final int HANDOVER_FAILURE_UNKNOWN

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when a handover fails for an unknown reason.

For more information on call handovers, see Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle).

Constant Value: 5 (0x00000005)

HANDOVER_FAILURE_USER_REJECTED

Added in API level 28
public static final int HANDOVER_FAILURE_USER_REJECTED

Handover failure reason returned via onHandoverFailed(android.telecom.Call, int) when the remote user rejects the handover request.

For more information on call handovers, see Call.handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle).

Constant Value: 3 (0x00000003)

Public constructors

Callback

public Callback ()

Public methods

onCallDestroyed

Added in API level 23
public void onCallDestroyed (Call call)

Invoked when the Call is destroyed. Clients should refrain from cleaning up their UI for the Call in response to state transitions. Specifically, clients should not assume that a onStateChanged(android.telecom.Call, int) with a state of Call.STATE_DISCONNECTED is the final notification the Call will send. Rather, clients should wait for this method to be invoked.

Parameters
call Call: The Call being destroyed.

onCannedTextResponsesLoaded

Added in API level 23
public void onCannedTextResponsesLoaded (Call call, 
                List<String> cannedTextResponses)

Invoked when the text messages that can be used as responses to the incoming Call are loaded from the relevant database. See Call.getCannedTextResponses().

Parameters
call Call: The Call invoking this method.

cannedTextResponses List: The text messages useable as responses.

onChildrenChanged

Added in API level 23
public void onChildrenChanged (Call call, 
                List<Call> children)

Invoked when the children of this Call have changed. See Call.getChildren().

Parameters
call Call: The Call invoking this method.

children List: The new children of the Call.

onConferenceableCallsChanged

Added in API level 23
public void onConferenceableCallsChanged (Call call, 
                List<Call> conferenceableCalls)

Invoked upon changes to the set of Calls with which this Call can be conferenced.

Parameters
call Call: The Call being updated.

conferenceableCalls List: The Calls with which this Call can be conferenced.

onConnectionEvent

Added in API level 25
public void onConnectionEvent (Call call, 
                String event, 
                Bundle extras)

Invoked when a Call receives an event from its associated Connection or Conference.

Where possible, the Call should make an attempt to handle Connection events which are part of the android.telecom.* namespace. The Call should ignore any events it does not wish to handle. Unexpected events should be handled gracefully, as it is possible that a ConnectionService has defined its own Connection events which a Call is not aware of.

See Connection#sendConnectionEvent(String, Bundle), Conference#sendConferenceEvent(String, Bundle).

Parameters
call Call: The Call receiving the event.

event String: The event.

extras Bundle: Extras associated with the connection event.

onDetailsChanged

Added in API level 23
public void onDetailsChanged (Call call, 
                Call.Details details)

Invoked when the details of this Call have changed. See Call.getDetails().

Parameters
call Call: The Call invoking this method.

details Call.Details: A Details object describing the Call.

onHandoverComplete

Added in API level 28
public void onHandoverComplete (Call call)

Invoked when Call handover from one PhoneAccount to other PhoneAccount has completed successfully.

For a full discussion of the handover process and the APIs involved, see Call.handoverTo(PhoneAccountHandle, int, Bundle).

Parameters
call Call: The call which had initiated handover.

onHandoverFailed

Added in API level 28
public void onHandoverFailed (Call call, 
                int failureReason)

Invoked when Call handover from one PhoneAccount to other PhoneAccount has failed.

For a full discussion of the handover process and the APIs involved, see Call.handoverTo(PhoneAccountHandle, int, Bundle).

Parameters
call Call: The call which had initiated handover.

failureReason int: Error reason for failure. Value is HANDOVER_FAILURE_DEST_APP_REJECTED, HANDOVER_FAILURE_NOT_SUPPORTED, HANDOVER_FAILURE_USER_REJECTED, HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL, or HANDOVER_FAILURE_UNKNOWN

onParentChanged

Added in API level 23
public void onParentChanged (Call call, 
                Call parent)

Invoked when the parent of this Call has changed. See Call.getParent().

Parameters
call Call: The Call invoking this method.

parent Call: The new parent of the Call.

onPostDialWait

Added in API level 23
public void onPostDialWait (Call call, 
                String remainingPostDialSequence)

Invoked when the post-dial sequence in the outgoing Call has reached a pause character. This causes the post-dial signals to stop pending user confirmation. An implementation should present this choice to the user and invoke Call.postDialContinue(boolean) when the user makes the choice.

Parameters
call Call: The Call invoking this method.

remainingPostDialSequence String: The post-dial characters that remain to be sent.

onRttInitiationFailure

Added in API level 26
public void onRttInitiationFailure (Call call, 
                int reason)

Invoked when the RTT session failed to initiate for some reason, including rejection by the remote party.

This callback will ONLY be invoked to report a failure related to a user initiated session modification request (i.e. Call#sendRttRequest()).

If a call is initiated with TelecomManager#EXTRA_START_CALL_WITH_RTT specified, the availability of RTT can be determined by checking Details#PROPERTY_RTT once the call enters state Details#STATE_ACTIVE.

Parameters
call Call: The call which the RTT initiation failure occurred on.

reason int: One of the status codes defined in Connection.RttModifyStatus, with the exception of Connection.RttModifyStatus.SESSION_MODIFY_REQUEST_SUCCESS. Value is Connection.RttModifyStatus.SESSION_MODIFY_REQUEST_SUCCESS, Connection.RttModifyStatus.SESSION_MODIFY_REQUEST_FAIL, Connection.RttModifyStatus.SESSION_MODIFY_REQUEST_INVALID, Connection.RttModifyStatus.SESSION_MODIFY_REQUEST_TIMED_OUT, or Connection.RttModifyStatus.SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE

onRttModeChanged

Added in API level 26
public void onRttModeChanged (Call call, 
                int mode)

Invoked when the RTT mode changes for this call.

Parameters
call Call: The call whose RTT mode has changed.

mode int: the new RTT mode, one of RttCall#RTT_MODE_FULL, RttCall#RTT_MODE_HCO, or RttCall#RTT_MODE_VCO

onRttRequest

Added in API level 26
public void onRttRequest (Call call, 
                int id)

Invoked when the remote end of the connection has requested that an RTT communication channel be opened. A response to this should be sent via Call.respondToRttRequest(int, boolean) with the same ID that this method is invoked with.

Parameters
call Call: The call which the RTT request was placed on

id int: The ID of the request.

onRttStatusChanged

Added in API level 26
public void onRttStatusChanged (Call call, 
                boolean enabled, 
                Call.RttCall rttCall)

Invoked when the call's RTT status changes, either from off to on or from on to off.

Parameters
call Call: The call whose RTT status has changed.

enabled boolean: whether RTT is now enabled or disabled

rttCall Call.RttCall: the RttCall object to use for reading and writing if RTT is now on, null otherwise.

onStateChanged

Added in API level 23
public void onStateChanged (Call call, 
                int state)

Invoked when the state of this Call has changed. See Call.getState().

Parameters
call Call: The Call invoking this method.

state int: The new state of the Call. Value is Call.STATE_NEW, Call.STATE_DIALING, Call.STATE_RINGING, Call.STATE_HOLDING, Call.STATE_ACTIVE, Call.STATE_DISCONNECTED, Call.STATE_SELECT_PHONE_ACCOUNT, Call.STATE_CONNECTING, Call.STATE_DISCONNECTING, Call.STATE_PULLING_CALL, Call.STATE_AUDIO_PROCESSING, or Call.STATE_SIMULATED_RINGING

onVideoCallChanged

Added in API level 23
public void onVideoCallChanged (Call call, 
                InCallService.VideoCall videoCall)

Invoked when the Call.VideoCall of the Call has changed.

Parameters
call Call: The Call invoking this method.

videoCall InCallService.VideoCall: The Call.VideoCall associated with the Call.