Added in API level 23

DisconnectCause

class DisconnectCause : Parcelable
kotlin.Any
   ↳ android.telecom.DisconnectCause

Describes the cause of a disconnected call. This always includes a code describing the generic cause of the disconnect. Optionally, it may include a label and/or description to display to the user. It is the responsibility of the ConnectionService to provide localized versions of the label and description. It also may contain a reason for the disconnect, which is intended for logging and not for display to the user.

Summary

Constants
static Int

Disconnected because the user did not locally answer the incoming call, but it was answered on another device where the call was ringing.

static Int

Disconnected because the other party was busy.

static Int

Disconnected because the call was pulled from the current device to another device.

static Int

Disconnected because it has been canceled.

static Int

Disconnected because the connection manager did not support the call.

static Int

Disconnected because there was an error, such as a problem with the network.

static Int

Disconnected because of a local user-initiated action, such as hanging up.

static Int

Disconnected because there was no response to an incoming call.

static Int

Disconnected for reason not described by other disconnect codes.

static String

This reason is set when a call is ended in order to place an emergency call when a PhoneAccount doesn't support holding an ongoing call to place an emergency call.

static String

Reason code (returned via getReason()), which indicates that the connection service is setting the call's state to Call#STATE_DISCONNECTED because it is internally changing the representation of an IMS conference call to simulate a single-party call.

static String

Reason code (returned via getReason()), which indicates that the call was disconnected because IMS access is blocked.

static String

Reason code (returned via getReason()) which indicates that a call could not be completed because the cellular radio is off or out of service, the device is connected to a wifi network, but the user has not enabled wifi calling.

static Int

Disconnected because the user rejected an incoming call.

static Int

Disconnected because the remote party hung up an ongoing call, or because an outgoing call was not answered by the remote party.

static Int

Disconnected because of a restriction on placing the call, such as dialing in airplane mode.

static Int

Disconnected because of an unknown or unspecified reason.

Inherited constants
Public constructors

Creates a new DisconnectCause.

DisconnectCause(code: Int, reason: String!)

Creates a new DisconnectCause.

DisconnectCause(code: Int, label: CharSequence!, description: CharSequence!, reason: String!)

Creates a new DisconnectCause.

DisconnectCause(code: Int, label: CharSequence!, description: CharSequence!, reason: String!, toneToPlay: Int)

Creates a new DisconnectCause.

Public methods
Int

Boolean
equals(other: Any?)

Int

Returns the code for the reason for this disconnect.

CharSequence!

Returns a description which explains the reason for the disconnect cause and is for display in the user interface.

CharSequence!

Returns a short label which explains the reason for the disconnect cause and is for display in the user interface.

String!

Returns an explanation of the reason for the disconnect.

Int

Returns the tone to play when disconnected.

Int

String

Unit
writeToParcel(destination: Parcel, flags: Int)

Properties
static Parcelable.Creator<DisconnectCause!>

Constants

ANSWERED_ELSEWHERE

Added in API level 25
static val ANSWERED_ELSEWHERE: Int

Disconnected because the user did not locally answer the incoming call, but it was answered on another device where the call was ringing.

Value: 11

BUSY

Added in API level 23
static val BUSY: Int

Disconnected because the other party was busy.

Value: 7

CALL_PULLED

Added in API level 25
static val CALL_PULLED: Int

Disconnected because the call was pulled from the current device to another device.

Value: 12

CANCELED

Added in API level 23
static val CANCELED: Int

Disconnected because it has been canceled.

Value: 4

CONNECTION_MANAGER_NOT_SUPPORTED

Added in API level 23
static val CONNECTION_MANAGER_NOT_SUPPORTED: Int

Disconnected because the connection manager did not support the call. The call will be tried again without a connection manager. See PhoneAccount#CAPABILITY_CONNECTION_MANAGER.

Value: 10

ERROR

Added in API level 23
static val ERROR: Int

Disconnected because there was an error, such as a problem with the network.

Value: 1

LOCAL

Added in API level 23
static val LOCAL: Int

Disconnected because of a local user-initiated action, such as hanging up.

Value: 2

MISSED

Added in API level 23
static val MISSED: Int

Disconnected because there was no response to an incoming call.

Value: 5

OTHER

Added in API level 23
static val OTHER: Int

Disconnected for reason not described by other disconnect codes.

Value: 9

REASON_EMERGENCY_CALL_PLACED

Added in API level 30
static val REASON_EMERGENCY_CALL_PLACED: String

This reason is set when a call is ended in order to place an emergency call when a PhoneAccount doesn't support holding an ongoing call to place an emergency call. This reason string should only be associated with the LOCAL disconnect code returned from getCode().

Value: "REASON_EMERGENCY_CALL_PLACED"

REASON_EMULATING_SINGLE_CALL

Added in API level 31
static val REASON_EMULATING_SINGLE_CALL: String

Reason code (returned via getReason()), which indicates that the connection service is setting the call's state to Call#STATE_DISCONNECTED because it is internally changing the representation of an IMS conference call to simulate a single-party call. This reason code is only used for communication between a ConnectionService and Telecom and should not be surfaced to the user.

Value: "EMULATING_SINGLE_CALL"

REASON_IMS_ACCESS_BLOCKED

Added in API level 31
static val REASON_IMS_ACCESS_BLOCKED: String

Reason code (returned via getReason()), which indicates that the call was disconnected because IMS access is blocked.

Value: "REASON_IMS_ACCESS_BLOCKED"

REASON_WIFI_ON_BUT_WFC_OFF

Added in API level 31
static val REASON_WIFI_ON_BUT_WFC_OFF: String

Reason code (returned via getReason()) which indicates that a call could not be completed because the cellular radio is off or out of service, the device is connected to a wifi network, but the user has not enabled wifi calling.

Value: "REASON_WIFI_ON_BUT_WFC_OFF"

REJECTED

Added in API level 23
static val REJECTED: Int

Disconnected because the user rejected an incoming call.

Value: 6

REMOTE

Added in API level 23
static val REMOTE: Int

Disconnected because the remote party hung up an ongoing call, or because an outgoing call was not answered by the remote party.

Value: 3

RESTRICTED

Added in API level 23
static val RESTRICTED: Int

Disconnected because of a restriction on placing the call, such as dialing in airplane mode.

Value: 8

UNKNOWN

Added in API level 23
static val UNKNOWN: Int

Disconnected because of an unknown or unspecified reason.

Value: 0

Public constructors

DisconnectCause

Added in API level 23
DisconnectCause(code: Int)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.

DisconnectCause

Added in API level 23
DisconnectCause(
    code: Int,
    reason: String!)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
reason String!: The reason for the disconnect.

DisconnectCause

Added in API level 23
DisconnectCause(
    code: Int,
    label: CharSequence!,
    description: CharSequence!,
    reason: String!)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
label CharSequence!: The localized label to show to the user to explain the disconnect.
description CharSequence!: The localized description to show to the user to explain the disconnect.
reason String!: The reason for the disconnect.

DisconnectCause

Added in API level 23
DisconnectCause(
    code: Int,
    label: CharSequence!,
    description: CharSequence!,
    reason: String!,
    toneToPlay: Int)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
label CharSequence!: The localized label to show to the user to explain the disconnect.
description CharSequence!: The localized description to show to the user to explain the disconnect.
reason String!: The reason for the disconnect.
toneToPlay Int: The tone to play on disconnect, as defined in ToneGenerator.

Public methods

describeContents

Added in API level 23
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 23
fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getCode

Added in API level 23
fun getCode(): Int

Returns the code for the reason for this disconnect.

Return
Int The disconnect code.

getDescription

Added in API level 23
fun getDescription(): CharSequence!

Returns a description which explains the reason for the disconnect cause and is for display in the user interface. This optional text is generally a longer and more descriptive version of getLabel, however it can exist even if getLabel is empty. The In-Call UI should display this relatively prominently; the traditional implementation displays this as an alert dialog. The ConnectionService is responsible for providing and localizing this message. If there is no string provided, returns null.

Return
CharSequence! The disconnect description.

getLabel

Added in API level 23
fun getLabel(): CharSequence!

Returns a short label which explains the reason for the disconnect cause and is for display in the user interface. If not null, it is expected that the In-Call UI should display this text where it would normally display the call state ("Dialing", "Disconnected") and is therefore expected to be relatively small. The ConnectionService is responsible for providing and localizing this label. If there is no string provided, returns null.

Return
CharSequence! The disconnect label.

getReason

Added in API level 23
fun getReason(): String!

Returns an explanation of the reason for the disconnect. This is not intended for display to the user and is used mainly for logging.

Return
String! The disconnect reason.

getTone

Added in API level 23
fun getTone(): Int

Returns the tone to play when disconnected.

Return
Int the tone as defined in ToneGenerator to play when disconnected.

hashCode

Added in API level 23
fun hashCode(): Int
Return
Int a hash code value for this object.

toString

Added in API level 23
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 23
fun writeToParcel(
    destination: Parcel,
    flags: Int
): Unit
Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 23
static val CREATOR: Parcelable.Creator<DisconnectCause!>