Added in API level 23

Callback


abstract class Callback
kotlin.Any
   ↳ 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
static Int

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

static Int

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.

static Int

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

static Int

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

static Int

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

Public constructors

Public methods
open Unit

Invoked when the Call is destroyed.

open Unit
onCannedTextResponsesLoaded(call: Call!, cannedTextResponses: MutableList<String!>!)

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

open Unit
onChildrenChanged(call: Call!, children: MutableList<Call!>!)

Invoked when the children of this Call have changed.

open Unit
onConferenceableCallsChanged(call: Call!, conferenceableCalls: MutableList<Call!>!)

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

open Unit
onConnectionEvent(call: Call!, event: String!, extras: Bundle!)

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

open Unit
onDetailsChanged(call: Call!, details: Call.Details!)

Invoked when the details of this Call have changed.

open Unit

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

open Unit
onHandoverFailed(call: Call!, failureReason: Int)

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

open Unit
onParentChanged(call: Call!, parent: Call!)

Invoked when the parent of this Call has changed.

open Unit
onPostDialWait(call: Call!, remainingPostDialSequence: String!)

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

open Unit
onRttInitiationFailure(call: Call!, reason: Int)

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

open Unit
onRttModeChanged(call: Call!, mode: Int)

Invoked when the RTT mode changes for this call.

open Unit
onRttRequest(call: Call!, id: Int)

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

open Unit
onRttStatusChanged(call: Call!, enabled: Boolean, rttCall: Call.RttCall!)

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

open Unit
onStateChanged(call: Call!, state: Int)

Invoked when the state of this Call has changed.

open Unit

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

Constants

HANDOVER_FAILURE_DEST_APP_REJECTED

Added in API level 28
static val HANDOVER_FAILURE_DEST_APP_REJECTED: Int

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,.

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

Value: 1

HANDOVER_FAILURE_NOT_SUPPORTED

Added in API level 28
static val HANDOVER_FAILURE_NOT_SUPPORTED: Int

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 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 handoverTo(android.telecom.PhoneAccountHandle,int,android.os.Bundle).

Value: 2

HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL

Added in API level 28
static val HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL: Int

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

This error code is returned when 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 handoverTo(android.telecom.PhoneAccountHandle,int,android.os.Bundle).

Value: 4

HANDOVER_FAILURE_UNKNOWN

Added in API level 28
static val HANDOVER_FAILURE_UNKNOWN: Int

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 handoverTo(android.telecom.PhoneAccountHandle,int,android.os.Bundle).

Value: 5

HANDOVER_FAILURE_USER_REJECTED

Added in API level 28
static val HANDOVER_FAILURE_USER_REJECTED: Int

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 handoverTo(android.telecom.PhoneAccountHandle,int,android.os.Bundle).

Value: 3

Public constructors

Callback

Callback()

Public methods

onCallDestroyed

Added in API level 23
open fun onCallDestroyed(call: Call!): Unit

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 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
open fun onCannedTextResponsesLoaded(
    call: Call!,
    cannedTextResponses: MutableList<String!>!
): Unit

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

Parameters
call Call!: The Call invoking this method.
cannedTextResponses MutableList<String!>!: The text messages useable as responses.

onChildrenChanged

Added in API level 23
open fun onChildrenChanged(
    call: Call!,
    children: MutableList<Call!>!
): Unit

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

Parameters
call Call!: The Call invoking this method.
children MutableList<Call!>!: The new children of the Call.

onConferenceableCallsChanged

Added in API level 23
open fun onConferenceableCallsChanged(
    call: Call!,
    conferenceableCalls: MutableList<Call!>!
): Unit

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

Parameters
call Call!: The Call being updated.
conferenceableCalls MutableList<Call!>!: The Calls with which this Call can be conferenced.

onConnectionEvent

Added in API level 25
open fun onConnectionEvent(
    call: Call!,
    event: String!,
    extras: Bundle!
): Unit

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
open fun onDetailsChanged(
    call: Call!,
    details: Call.Details!
): Unit

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

Parameters
call Call!: The Call invoking this method.
details Call.Details!: A Details object describing the Call.

onHandoverComplete

Added in API level 28
open fun onHandoverComplete(call: Call!): Unit

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 android.telecom.Call#handoverTo(PhoneAccountHandle, int, Bundle).

Parameters
call Call!: The call which had initiated handover.

onHandoverFailed

Added in API level 28
open fun onHandoverFailed(
    call: Call!,
    failureReason: Int
): Unit

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 android.telecom.Call#handoverTo(PhoneAccountHandle, int, Bundle).

Parameters
call Call!: The call which had initiated handover.
failureReason Int: Error reason for failure. Value is android.telecom.Call.Callback#HANDOVER_FAILURE_DEST_APP_REJECTED, android.telecom.Call.Callback#HANDOVER_FAILURE_NOT_SUPPORTED, android.telecom.Call.Callback#HANDOVER_FAILURE_USER_REJECTED, android.telecom.Call.Callback#HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL, or android.telecom.Call.Callback#HANDOVER_FAILURE_UNKNOWN

onParentChanged

Added in API level 23
open fun onParentChanged(
    call: Call!,
    parent: Call!
): Unit

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

Parameters
call Call!: The Call invoking this method.
parent Call!: The new parent of the Call.

onPostDialWait

Added in API level 23
open fun onPostDialWait(
    call: Call!,
    remainingPostDialSequence: String!
): Unit

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 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
open fun onRttInitiationFailure(
    call: Call!,
    reason: Int
): Unit

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 android.telecom.Connection.RttModifyStatus, with the exception of android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS. Value is android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS, android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_FAIL, android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_INVALID, android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_TIMED_OUT, or android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE

onRttModeChanged

Added in API level 26
open fun onRttModeChanged(
    call: Call!,
    mode: Int
): Unit

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
open fun onRttRequest(
    call: Call!,
    id: Int
): Unit

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 respondToRttRequest 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
open fun onRttStatusChanged(
    call: Call!,
    enabled: Boolean,
    rttCall: Call.RttCall!
): Unit

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.

onVideoCallChanged

Added in API level 23
open fun onVideoCallChanged(
    call: Call!,
    videoCall: InCallService.VideoCall!
): Unit

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.