Call
class Call
| kotlin.Any | |
| ↳ | android.telecom.Call |
Represents an ongoing phone call that the in-call app should present to the user.
Summary
Nested classes |
|
|---|---|
| abstract |
Defines callbacks which inform the |
|
A class that holds the state that describes the state of the RTT channel to the remote party, if it is active. |
|
Constants |
|
|---|---|
| static String |
The key to retrieve the optional |
| static String |
Extra key used to indicate the time (in milliseconds since midnight, January 1, 1970 UTC) when the last outgoing emergency call was made. |
| static String |
Extra key used to indicate whether a |
| static String |
Key for extra used to pass along a list of |
| static Int |
Reject reason used with |
| static Int |
Reject reason used with |
| static Int |
The state of a |
| static Int |
The state of a call that is active with the network, but the audio from the call is being intercepted by an app on the local device. |
| static Int |
The initial state of an outgoing |
| static Int |
The state of an outgoing |
| static Int |
The state of a |
| static Int |
The state of a |
| static Int |
The state of a |
| static Int |
The state of a |
| static Int |
The state of an external call which is in the process of being pulled from a remote device to the local device. |
| static Int |
The state of an incoming |
| static Int |
The state of an outgoing |
| static Int |
The state of a call that is being presented to the user after being in |
Public methods |
|
|---|---|
| Unit |
Instructs this |
| Unit |
conference(callToConferenceWith: Call!)Instructs this |
| Unit |
Instructs this |
| Unit |
Instructs this |
| MutableList<String!>! |
Obtains a list of canned, pre-configured message responses to present to the user as ways of rejecting this |
| MutableList<Call!>! |
Obtains the children of this conference |
| MutableList<Call!>! |
Returns the list of |
| Call.Details! |
Obtains an object containing call details. |
| Call? |
Returns the child |
| Call! |
Obtains the parent of this |
| String! |
Obtains the post-dial sequence remaining to be emitted by this |
| Call.RttCall? |
Returns this call's RttCall object. |
| Int |
getState()Obtains the state of this |
| InCallService.VideoCall! |
Obtains an object that can be used to display video from this |
| Unit |
handoverTo(toHandle: PhoneAccountHandle!, videoState: Int, extras: Bundle!)Initiates a handover of this |
| Unit |
hold()Instructs this |
| Boolean |
Returns whether this call has an active RTT connection. |
| Unit |
Merges the calls within this conference. |
| Unit |
phoneAccountSelected(accountHandle: PhoneAccountHandle!, setDefault: Boolean)Notifies this |
| Unit |
playDtmfTone(digit: Char)Instructs this |
| Unit |
postDialContinue(proceed: Boolean)Instructs this |
| Unit |
Initiates a request to the |
| Unit |
Adds some extras to this |
| Unit |
registerCallback(callback: Call.Callback!)Registers a callback to this |
| Unit |
registerCallback(callback: Call.Callback!, handler: Handler!)Registers a callback to this |
| Unit |
Instructs this |
| Unit |
Instructs the |
| Unit |
removeExtras(keys: MutableList<String!>!)Removes extras from this |
| Unit |
removeExtras(vararg keys: String!)Removes extras from this |
| Unit |
respondToRttRequest(id: Int, accept: Boolean)Responds to an RTT request received via the |
| Unit |
sendCallEvent(event: String!, extras: Bundle!)Sends a |
| Unit |
Sends an RTT upgrade request to the remote end of the connection. |
| Unit |
Instructs this |
| Unit |
Instructs this |
| Unit |
stopRtt()Terminate the RTT session on this call. |
| Unit |
Swaps the calls within this conference. |
| String |
toString() |
| Unit |
unhold()Instructs this |
| Unit |
unregisterCallback(callback: Call.Callback!)Unregisters a callback from this |
Constants
AVAILABLE_PHONE_ACCOUNTS
static valAVAILABLE_PHONE_ACCOUNTS: String
Deprecated: Use the list from EXTRA_SUGGESTED_PHONE_ACCOUNTS instead.
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.
Value: "selectPhoneAccountAccounts"
EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS
static val EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS: String
Extra key used to indicate the time (in milliseconds since midnight, January 1, 1970 UTC) when the last outgoing emergency call was made. This is used to identify potential emergency callbacks.
Value: "android.telecom.extra.LAST_EMERGENCY_CALLBACK_TIME_MILLIS"
EXTRA_SILENT_RINGING_REQUESTED
static val EXTRA_SILENT_RINGING_REQUESTED: String
Extra key used to indicate whether a CallScreeningService has requested to silence the ringtone for a call. If the InCallService declares TelecomManager#METADATA_IN_CALL_SERVICE_RINGING in its manifest, it should not play a ringtone for an incoming call with this extra key set.
Value: "android.telecom.extra.SILENT_RINGING_REQUESTED"
EXTRA_SUGGESTED_PHONE_ACCOUNTS
static val EXTRA_SUGGESTED_PHONE_ACCOUNTS: String
Key for extra used to pass along a list of PhoneAccountSuggestions to the in-call UI when a call enters the STATE_SELECT_PHONE_ACCOUNT state. The list included here will have the same length and be in the same order as the list passed with AVAILABLE_PHONE_ACCOUNTS.
Value: "android.telecom.extra.SUGGESTED_PHONE_ACCOUNTS"
REJECT_REASON_DECLINED
static val REJECT_REASON_DECLINED: Int
Reject reason used with reject(int) to indicate that the user is rejecting this call because they have declined to answer it. This typically means that they are unable to answer the call at this time and would prefer it be sent to voicemail.
Value: 1
REJECT_REASON_UNWANTED
static val REJECT_REASON_UNWANTED: Int
Reject reason used with reject(int) to indicate that the user is rejecting this call because it is an unwanted call. This allows the user to indicate that they are rejecting a call because it is likely a nuisance call.
Value: 2
STATE_ACTIVE
static val STATE_ACTIVE: Int
The state of a Call when actively supporting conversation.
Value: 4
STATE_AUDIO_PROCESSING
static val STATE_AUDIO_PROCESSING: Int
The state of a call that is active with the network, but the audio from the call is being intercepted by an app on the local device. Telecom does not hold audio focus in this state, and the call will be invisible to the user except for a persistent notification.
Value: 12
STATE_CONNECTING
static val STATE_CONNECTING: Int
The initial state of an outgoing Call. Common transitions are to STATE_DIALING state for a successful call or STATE_DISCONNECTED if it failed.
Value: 9
STATE_DIALING
static val STATE_DIALING: Int
The state of an outgoing Call when dialing the remote number, but not yet connected.
Value: 1
STATE_DISCONNECTED
static val STATE_DISCONNECTED: Int
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.
Value: 7
STATE_DISCONNECTING
static val STATE_DISCONNECTING: Int
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.
Value: 10
STATE_HOLDING
static val STATE_HOLDING: Int
The state of a Call when in a holding state.
Value: 3
STATE_NEW
static val STATE_NEW: Int
The state of a Call when newly created.
Value: 0
STATE_PULLING_CALL
static val STATE_PULLING_CALL: Int
The state of an external call which is in the process of being pulled from a remote device to the local device.
A call can only be in this state if the Details#PROPERTY_IS_EXTERNAL_CALL property and Details#CAPABILITY_CAN_PULL_CALL capability are set on the call.
An InCallService will only see this state if it has the TelecomManager#METADATA_INCLUDE_EXTERNAL_CALLS metadata set to true in its manifest.
Value: 11
STATE_RINGING
static val STATE_RINGING: Int
The state of an incoming Call when ringing locally, but not yet connected.
Value: 2
STATE_SELECT_PHONE_ACCOUNT
static val STATE_SELECT_PHONE_ACCOUNT: Int
The state of an outgoing Call when waiting on user to select a PhoneAccount through which to place the call.
Value: 8
STATE_SIMULATED_RINGING
static val STATE_SIMULATED_RINGING: Int
The state of a call that is being presented to the user after being in STATE_AUDIO_PROCESSING. The call is still active with the network in this case, and Telecom will hold audio focus and play a ringtone if appropriate.
Value: 13
Public methods
answer
fun answer(videoState: Int): Unit
Instructs this STATE_RINGING Call to answer.
| Parameters | |
|---|---|
videoState |
Int: The video state in which to answer the call. Value is either 0 or a combination of android.telecom.VideoProfile#STATE_AUDIO_ONLY, android.telecom.VideoProfile#STATE_TX_ENABLED, android.telecom.VideoProfile#STATE_RX_ENABLED, android.telecom.VideoProfile#STATE_BIDIRECTIONAL, and android.telecom.VideoProfile#STATE_PAUSED |
conference
fun conference(callToConferenceWith: Call!): Unit
Instructs this Call to enter a conference.
| Parameters | |
|---|---|
callToConferenceWith |
Call!: The other call with which to conference. |
deflect
fun deflect(address: Uri!): Unit
Instructs this STATE_RINGING Call to deflect.
| Parameters | |
|---|---|
address |
Uri!: The address to which the call will be deflected. |
getCannedTextResponses
fun getCannedTextResponses(): MutableList<String!>!
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.
| Return | |
|---|---|
MutableList<String!>! |
A list of canned text message responses. |
See Also
getChildren
fun getChildren(): MutableList<Call!>!
Obtains the children of this conference Call, if any.
| Return | |
|---|---|
MutableList<Call!>! |
The children of this Call if this Call is a conference, or an empty List otherwise. |
getConferenceableCalls
fun getConferenceableCalls(): MutableList<Call!>!
Returns the list of Calls with which this Call is allowed to conference.
| Return | |
|---|---|
MutableList<Call!>! |
The list of conferenceable Calls. |
getDetails
fun getDetails(): Call.Details!
Obtains an object containing call details.
| Return | |
|---|---|
Call.Details! |
A Details object. Depending on the state of the Call, the result may be null. |
getGenericConferenceActiveChildCall
fun getGenericConferenceActiveChildCall(): Call?
Returns the child Call in a generic conference that is currently active. A "generic conference" is the mechanism used to support two simultaneous calls on a device in CDMA networks. It is effectively equivalent to having one call active and one call on hold in GSM or IMS calls. This method returns the currently active call. In a generic conference, the network exposes the conference to us as a single call, and we switch between talking to the two participants using a CDMA flash command. Since the network exposes no additional information about the call, the only way we know which caller we're currently talking to is by keeping track of the flash commands that we've sent to the network. For calls that are not generic conferences, or when the generic conference has more than 2 children, returns null.
| Return | |
|---|---|
Call? |
The active child call. |
getParent
fun getParent(): Call!
Obtains the parent of this Call in a conference, if any.
| Return | |
|---|---|
Call! |
The parent Call, or null if this Call is not a child of any conference Calls. |
getRemainingPostDialSequence
fun getRemainingPostDialSequence(): String!
Obtains the post-dial sequence remaining to be emitted by this Call, if any.
| Return | |
|---|---|
String! |
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. |
getRttCall
fun getRttCall(): Call.RttCall?
Returns this call's RttCall object. The RttCall instance is used to send and receive RTT text data, as well as to change the RTT mode.
| Return | |
|---|---|
Call.RttCall? |
A Call.RttCall. null if there is no active RTT connection. |
getState
fun getState(): Int
Obtains the state of this Call.
| Return | |
|---|---|
Int |
A state value, chosen from the STATE_* constants. |
getVideoCall
fun getVideoCall(): InCallService.VideoCall!
Obtains an object that can be used to display video from this Call.
| Return | |
|---|---|
InCallService.VideoCall! |
An Call.VideoCall. |
handoverTo
fun handoverTo(
toHandle: PhoneAccountHandle!,
videoState: Int,
extras: Bundle!
): Unit
Initiates a handover of this Call to the ConnectionService identified by toHandle. The videoState specified indicates the desired video state after the handover.
A call handover is the process where an ongoing call is transferred from one app (i.e. ConnectionService to another app. The user could, for example, choose to continue a mobile network call in a video calling app. The mobile network call via the Telephony stack is referred to as the source of the handover, and the video calling app is referred to as the destination.
When considering a handover scenario the device this method is called on is considered the initiating device (since the user initiates the handover from this device), and the other device is considered the receiving device.
When this method is called on the initiating device, the Telecom framework will bind to the ConnectionService defined by the toHandle PhoneAccountHandle and invoke ConnectionService#onCreateOutgoingHandoverConnection(PhoneAccountHandle, to inform the destination app that a request has been made to handover a call to it. The app returns an instance of Connection to represent the handover call At this point the app should display UI to indicate to the user that a call handover is in process.
The destination app is responsible for communicating the handover request from the initiating device to the receiving device.
When the app on the receiving device receives the handover request, it calls TelecomManager#acceptHandover(Uri, int, PhoneAccountHandle) to continue the handover process from the initiating device to the receiving device. At this point the destination app on the receiving device should show UI to allow the user to choose whether they want to continue their call in the destination app.
When the destination app on the receiving device calls TelecomManager#acceptHandover(Uri, int, PhoneAccountHandle), Telecom will bind to its ConnectionService and call ConnectionService#onCreateIncomingHandoverConnection(PhoneAccountHandle, to inform it of the handover request. The app returns an instance of Connection to represent the handover call.
If the user of the receiving device accepts the handover, the app calls Connection#setActive() to complete the handover process; Telecom will disconnect the original call. If the user rejects the handover, the app calls Connection#setDisconnected(DisconnectCause) and specifies a DisconnectCause of DisconnectCause#CANCELED to indicate that the handover has been cancelled.
Telecom will only allow handovers from PhoneAccounts which declare PhoneAccount#EXTRA_SUPPORTS_HANDOVER_FROM. Similarly, the PhoneAccount specified by toHandle must declare PhoneAccount#EXTRA_SUPPORTS_HANDOVER_TO.
Errors in the handover process are reported to the InCallService via Callback#onHandoverFailed(Call, int). Errors in the handover process are reported to the involved ConnectionServices via ConnectionService#onHandoverFailed(ConnectionRequest, int).
| Parameters | |
|---|---|
toHandle |
PhoneAccountHandle!: PhoneAccountHandle of the ConnectionService to handover this call to. |
videoState |
Int: Indicates the video state desired after the handover (see the STATE_* constants defined in VideoProfile). Value is either 0 or a combination of android.telecom.VideoProfile#STATE_AUDIO_ONLY, android.telecom.VideoProfile#STATE_TX_ENABLED, android.telecom.VideoProfile#STATE_RX_ENABLED, android.telecom.VideoProfile#STATE_BIDIRECTIONAL, and android.telecom.VideoProfile#STATE_PAUSED |
extras |
Bundle!: Bundle containing extra information to be passed to the ConnectionService |
isRttActive
fun isRttActive(): Boolean
Returns whether this call has an active RTT connection.
| Return | |
|---|---|
Boolean |
true if there is a connection, false otherwise. |
mergeConference
fun mergeConference(): Unit
Merges the calls within this conference. See Details#CAPABILITY_MERGE_CONFERENCE.
phoneAccountSelected
fun phoneAccountSelected(
accountHandle: PhoneAccountHandle!,
setDefault: Boolean
): Unit
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.
playDtmfTone
fun playDtmfTone(digit: Char): Unit
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 |
Char: A character representing the DTMF digit for which to play the tone. This value must be one of '0' through '9', '*' or '#'. |
postDialContinue
fun postDialContinue(proceed: Boolean): Unit
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 TelecomManager#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 TelecomManager#DTMF_CHARACTER_WAIT symbol, this Call will pause playing the tones and notify callbacks via Callback#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 |
Boolean: Whether or not to continue with the post-dial sequence. |
pullExternalCall
fun pullExternalCall(): Unit
Initiates a request to the ConnectionService to pull an external call to the local device.
Calls to this method are ignored if the call does not have the Call.Details#PROPERTY_IS_EXTERNAL_CALL property set.
An InCallService will only see calls which support this method if it has the TelecomManager#METADATA_INCLUDE_EXTERNAL_CALLS metadata set to true in its manifest.
putExtras
fun putExtras(extras: Bundle!): Unit
Adds some extras to this Call. Existing keys are replaced and new ones are added.
No assumptions should be made as to how an In-Call UI or service will handle these extras. Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.
| Parameters | |
|---|---|
extras |
Bundle!: The extras to add. |
registerCallback
fun registerCallback(callback: Call.Callback!): Unit
Registers a callback to this Call.
| Parameters | |
|---|---|
callback |
Call.Callback!: A Callback. |
registerCallback
fun registerCallback(
callback: Call.Callback!,
handler: Handler!
): Unit
Registers a callback to this Call.
| Parameters | |
|---|---|
callback |
Call.Callback!: A Callback. |
handler |
Handler!: A handler which command and status changes will be delivered to. |
reject
fun reject(
rejectWithMessage: Boolean,
textMessage: String!
): Unit
Instructs this STATE_RINGING Call to reject.
| Parameters | |
|---|---|
rejectWithMessage |
Boolean: Whether to reject with a text message. |
textMessage |
String!: An optional text message with which to respond. |
reject
fun reject(rejectReason: Int): Unit
Instructs the ConnectionService providing this STATE_RINGING call that the user has chosen to reject the call and has indicated a reason why the call is being rejected.
| Parameters | |
|---|---|
rejectReason |
Int: the reason the call is being rejected. Value is android.telecom.Call#REJECT_REASON_DECLINED, or android.telecom.Call#REJECT_REASON_UNWANTED |
removeExtras
fun removeExtras(keys: MutableList<String!>!): Unit
Removes extras from this Call.
| Parameters | |
|---|---|
keys |
MutableList<String!>!: The keys of the extras to remove. |
removeExtras
fun removeExtras(vararg keys: String!): Unit
Removes extras from this Call.
| Parameters | |
|---|---|
keys |
String!: The keys of the extras to remove. |
respondToRttRequest
fun respondToRttRequest(
id: Int,
accept: Boolean
): Unit
Responds to an RTT request received via the Callback#onRttRequest(Call, int) )} callback. The ID used here should be the same as the ID that was received via the callback.
| Parameters | |
|---|---|
id |
Int: The request ID received via Callback#onRttRequest(Call, int) |
accept |
Boolean: true if the RTT request should be accepted, false otherwise. |
sendCallEvent
fun sendCallEvent(
event: String!,
extras: Bundle!
): Unit
Sends a Call event from this Call to the associated Connection in the ConnectionService.
Call events are used to communicate point in time information from an InCallService to a ConnectionService. A ConnectionService implementation could define events which enable the InCallService, for example, toggle a unique feature of the ConnectionService.
A ConnectionService can communicate to the InCallService using Connection#sendConnectionEvent(String, Bundle).
Events are exposed to ConnectionService implementations via android.telecom.Connection#onCallEvent(String, Bundle).
No assumptions should be made as to how a ConnectionService will handle these events. The InCallService must assume that the ConnectionService could chose to ignore some events altogether.
Events should be fully qualified (e.g., com.example.event.MY_EVENT) to avoid conflicts between InCallService implementations. Further, InCallService implementations shall not re-purpose events in the android.* namespace, nor shall they define their own event types in this namespace. When defining a custom event type, ensure the contents of the extras Bundle is clearly defined. Extra keys for this bundle should be named similar to the event type (e.g. com.example.extra.MY_EXTRA).
When defining events and the associated extras, it is important to keep their behavior consistent when the associated InCallService is updated. Support for deprecated events/extras should me maintained to ensure backwards compatibility with older ConnectionService implementations which were built to support the older behavior.
| Parameters | |
|---|---|
event |
String!: The connection event. |
extras |
Bundle!: Bundle containing extra information associated with the event. |
sendRttRequest
fun sendRttRequest(): Unit
Sends an RTT upgrade request to the remote end of the connection. Success is not guaranteed, and notification of success will be via the Callback#onRttStatusChanged(Call, boolean, RttCall) callback.
splitFromConference
fun splitFromConference(): Unit
Instructs this Call to split from any conference call with which it may be connected.
stopDtmfTone
fun stopDtmfTone(): Unit
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.
stopRtt
fun stopRtt(): Unit
Terminate the RTT session on this call. The resulting state change will be notified via the Callback#onRttStatusChanged(Call, boolean, RttCall) callback.
swapConference
fun swapConference(): Unit
Swaps the calls within this conference. See Details#CAPABILITY_SWAP_CONFERENCE.
toString
fun toString(): String
| Return | |
|---|---|
String |
a string representation of the object. |
unhold
fun unhold(): Unit
Instructs this STATE_HOLDING call to release from hold.
unregisterCallback
fun unregisterCallback(callback: Call.Callback!): Unit
Unregisters a callback from this Call.
| Parameters | |
|---|---|
callback |
Call.Callback!: A Callback. |