Added in API level 23

PhoneAccount

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

Represents a distinct method to place or receive a phone call. Apps which can place calls and want those calls to be integrated into the dialer and in-call UI should build an instance of this class and register it with the system using TelecomManager.

TelecomManager uses registered PhoneAccounts to present the user with alternative options when placing a phone call. When building a PhoneAccount, the app should supply a valid PhoneAccountHandle that references the connection service implementation Telecom will use to interact with the app.

Summary

Nested classes

Helper class for creating a PhoneAccount.

Constants
static Int

An adhoc conference call is established by providing a list of addresses to TelecomManager#startConference(List<Uri>, int videoState) where the ConnectionService is responsible for connecting all indicated participants to a conference simultaneously.

static Int

Flag indicating whether this PhoneAccount is capable of supporting the call composer functionality for enriched calls.

static Int

Flag indicating that this PhoneAccount can make phone calls in place of traditional SIM-based telephony calls.

static Int

Flag indicating that this PhoneAccount supports a subject for Calls.

static Int

Flag indicating that this PhoneAccount can act as a connection manager for other connections.

static Int

Flag indicating that this PhoneAccount is capable of placing emergency calls.

static Int

Flag indicating that this PhoneAccount is capable of making a call with an RTT (Real-time text) session.

static Int

Flag indicating that this PhoneAccount is responsible for managing its own Connections.

static Int

Flag indicating that this PhoneAccount represents a built-in PSTN SIM subscription.

static Int

Flag indicating that this voip app PhoneAccount supports the call streaming session to stream call audio to another remote device via streaming app.

static Int

Flag indicating that this PhoneAccount supports the use TelecomManager APIs that utilize android.os.OutcomeReceivers or java.util.function.Consumers.

static Int

Flag indicating that this PhoneAccount supports video calling.

static Int

Flag indicating that this PhoneAccount provides SIM-based voice calls, potentially as an over-the-top solution such as wi-fi calling.

static Int

Flag indicating that this PhoneAccount is currently able to place video calls.

static Int

Flag indicating that for this PhoneAccount, the ability to make a video call to a number relies on presence.

static Int

Flag indicating that this PhoneAccount is currently able to place SIM-based voice calls, similar to CAPABILITY_VIDEO_CALLING.

static String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether a Self-managed PhoneAccount want to expose its calls to all InCallService which declares the metadata TelecomManager#METADATA_INCLUDE_SELF_MANAGED_CALLS.

static String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates that all calls from this PhoneAccount should be treated as VoIP calls rather than cellular calls by the Telecom audio handling logic.

static String

PhoneAccount extras key (see PhoneAccount#getExtras()) which determines the character encoding to be used when determining the length of messages.

static String

PhoneAccount extras key (see PhoneAccount#getExtras()) which determines the maximum permitted length of a call subject specified via the TelecomManager#EXTRA_CALL_SUBJECT extra on an android.content.Intent#ACTION_CALL intent.

static String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether a Self-Managed PhoneAccount should log its calls to the call log.

static String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether this PhoneAccount is capable of supporting a request to handover a connection from this PhoneAccount to another PhoneAccount.

static String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether this PhoneAccount is capable of supporting a request to handover a connection (see android.telecom.Call#handoverTo()) to this PhoneAccount from a PhoneAccount specifying EXTRA_SUPPORTS_HANDOVER_FROM.

static Int

Indicating no hightlight color is set.

static Int

Indicating no resource ID is set.

static String

URI scheme for SIP URIs.

static String

URI scheme for telephone number URIs.

static String

URI scheme for voicemail URIs.

Inherited constants
Public methods
static PhoneAccount.Builder!
builder(accountHandle: PhoneAccountHandle!, label: CharSequence!)

Int

Boolean
equals(other: Any?)

PhoneAccountHandle!

The unique identifier of this PhoneAccount.

Uri!

The address (e.g., a phone number) associated with this

Int

The capabilities of this PhoneAccount.

Bundle!

The extras associated with this PhoneAccount.

Int

A highlight color to use in displaying information about this PhoneAccount.

Icon!

The icon to represent this PhoneAccount.

CharSequence!

A short label describing a PhoneAccount.

CharSequence!

A short paragraph describing this PhoneAccount.

Uri!

The raw callback number used for this PhoneAccount, as distinct from getAddress().

MutableList<String!>!

The URI schemes supported by this PhoneAccount.

Boolean
hasCapabilities(capability: Int)

Determines if this PhoneAccount has a capabilities specified by the passed in bit mask.

Int

Boolean

Indicates whether the user has enabled this PhoneAccount or not.

Boolean

Determines if the PhoneAccount supports calls to/from addresses with a specified URI scheme.

PhoneAccount.Builder!

Returns a builder initialized with the current PhoneAccount instance.

String

Unit
writeToParcel(out: Parcel, flags: Int)

Properties
static Parcelable.Creator<PhoneAccount!>

Constants

CAPABILITY_ADHOC_CONFERENCE_CALLING

Added in API level 30
static val CAPABILITY_ADHOC_CONFERENCE_CALLING: Int

An adhoc conference call is established by providing a list of addresses to TelecomManager#startConference(List<Uri>, int videoState) where the ConnectionService is responsible for connecting all indicated participants to a conference simultaneously. This is in contrast to conferences formed by merging calls together (e.g. using android.telecom.Call#mergeConference()).

Value: 16384

CAPABILITY_CALL_COMPOSER

Added in API level 31
static val CAPABILITY_CALL_COMPOSER: Int

Flag indicating whether this PhoneAccount is capable of supporting the call composer functionality for enriched calls.

Value: 32768

CAPABILITY_CALL_PROVIDER

Added in API level 23
static val CAPABILITY_CALL_PROVIDER: Int

Flag indicating that this PhoneAccount can make phone calls in place of traditional SIM-based telephony calls. This account will be treated as a distinct method for placing calls alongside the traditional SIM-based telephony stack. This flag is distinct from CAPABILITY_CONNECTION_MANAGER in that it is not allowed to manage or place calls from the built-in telephony stack.

See getCapabilities

Value: 2

CAPABILITY_CALL_SUBJECT

Added in API level 23
static val CAPABILITY_CALL_SUBJECT: Int

Flag indicating that this PhoneAccount supports a subject for Calls. This means a caller is able to specify a short subject line for an outgoing call. A capable receiving device displays the call subject on the incoming call screen.

See getCapabilities

Value: 64

CAPABILITY_CONNECTION_MANAGER

Added in API level 23
static val CAPABILITY_CONNECTION_MANAGER: Int

Flag indicating that this PhoneAccount can act as a connection manager for other connections. The ConnectionService associated with this PhoneAccount will be allowed to manage phone calls including using its own proprietary phone-call implementation (like VoIP calling) to make calls instead of the telephony stack.

When a user opts to place a call using the SIM-based telephony stack, the ConnectionService associated with this PhoneAccount will be attempted first if the user has explicitly selected it to be used as the default connection manager.

See getCapabilities

Value: 1

CAPABILITY_PLACE_EMERGENCY_CALLS

Added in API level 23
static val CAPABILITY_PLACE_EMERGENCY_CALLS: Int

Flag indicating that this PhoneAccount is capable of placing emergency calls. By default all PSTN PhoneAccounts are capable of placing emergency calls.

See getCapabilities

Value: 16

CAPABILITY_RTT

Added in API level 26
static val CAPABILITY_RTT: Int

Flag indicating that this PhoneAccount is capable of making a call with an RTT (Real-time text) session. When set, Telecom will attempt to open an RTT session on outgoing calls that specify that they should be placed with an RTT session , and the in-call app will be displayed with text entry fields for RTT. Likewise, the in-call app can request that an RTT session be opened during a call if this bit is set.

Value: 4096

CAPABILITY_SELF_MANAGED

Added in API level 26
static val CAPABILITY_SELF_MANAGED: Int

Flag indicating that this PhoneAccount is responsible for managing its own Connections. This type of PhoneAccount is ideal for use with standalone calling apps which do not wish to use the default phone app for Connection UX, but which want to leverage the call and audio routing capabilities of the Telecom framework.

When set, Connections created by the self-managed ConnectionService will not be surfaced to implementations of the InCallService API. Thus it is the responsibility of a self-managed ConnectionService to provide a user interface for its Connections.

Self-managed Connections will, however, be displayed on connected Bluetooth devices.

Value: 2048

CAPABILITY_SIM_SUBSCRIPTION

Added in API level 23
static val CAPABILITY_SIM_SUBSCRIPTION: Int

Flag indicating that this PhoneAccount represents a built-in PSTN SIM subscription.

Only the Android framework can register a PhoneAccount having this capability.

See getCapabilities

Value: 4

CAPABILITY_SUPPORTS_CALL_STREAMING

Added in API level 34
static val CAPABILITY_SUPPORTS_CALL_STREAMING: Int

Flag indicating that this voip app PhoneAccount supports the call streaming session to stream call audio to another remote device via streaming app.

Value: 524288

See Also

CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS

Added in API level 34
static val CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS: Int

Flag indicating that this PhoneAccount supports the use TelecomManager APIs that utilize android.os.OutcomeReceivers or java.util.function.Consumers. Be aware, if this capability is set, CAPABILITY_SELF_MANAGED will be amended by Telecom when this PhoneAccount is registered via TelecomManager#registerPhoneAccount(PhoneAccount).

android.os.OutcomeReceivers and java.util.function.Consumers represent transactional operations because the operation can succeed or fail. An app wishing to use transactional operations should define behavior for a successful and failed TelecomManager API call.

Value: 262144

CAPABILITY_SUPPORTS_VIDEO_CALLING

Added in API level 26
static val CAPABILITY_SUPPORTS_VIDEO_CALLING: Int

Flag indicating that this PhoneAccount supports video calling. This is not an indication that the PhoneAccount is currently able to make a video call, but rather that it has the ability to make video calls (but not necessarily at this time).

Whether a PhoneAccount can make a video call is ultimately controlled by CAPABILITY_VIDEO_CALLING, which indicates whether the PhoneAccount is currently capable of making a video call. Consider a case where, for example, a PhoneAccount supports making video calls (e.g. CAPABILITY_SUPPORTS_VIDEO_CALLING), but a current lack of network connectivity prevents video calls from being made (e.g. CAPABILITY_VIDEO_CALLING).

See getCapabilities

Value: 1024

CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS

Added in API level 33
static val CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS: Int

Flag indicating that this PhoneAccount provides SIM-based voice calls, potentially as an over-the-top solution such as wi-fi calling.

Similar to CAPABILITY_SUPPORTS_VIDEO_CALLING, this capability indicates this PhoneAccount has the ability to make voice calls (but not necessarily at this time). Whether this PhoneAccount can make a voice call is ultimately controlled by CAPABILITY_VOICE_CALLING_AVAILABLE, which indicates whether this PhoneAccount is currently capable of making a voice call. Consider a case where, for example, a PhoneAccount supports making voice calls (e.g. CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS), but a current lack of network connectivity prevents voice calls from being made (e.g. CAPABILITY_VOICE_CALLING_AVAILABLE).

In order to declare this capability, this PhoneAccount must also declare CAPABILITY_SIM_SUBSCRIPTION or CAPABILITY_CONNECTION_MANAGER and satisfy the associated requirements.

Value: 65536

CAPABILITY_VIDEO_CALLING

Added in API level 23
static val CAPABILITY_VIDEO_CALLING: Int

Flag indicating that this PhoneAccount is currently able to place video calls.

See also CAPABILITY_SUPPORTS_VIDEO_CALLING which indicates whether the PhoneAccount supports placing video calls.

See getCapabilities

Value: 8

CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE

Added in API level 24
static val CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE: Int

Flag indicating that for this PhoneAccount, the ability to make a video call to a number relies on presence. Should only be set if the PhoneAccount also has CAPABILITY_VIDEO_CALLING.

Note: As of Android 12, using the android.provider.ContactsContract.Data#CARRIER_PRESENCE_VT_CAPABLE bit on the android.provider.ContactsContract.Data#CARRIER_PRESENCE column to indicate whether a contact's phone number supports video calling has been deprecated and should only be used on devices where CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL is set. On newer devices, applications must use android.telephony.ims.RcsUceAdapter instead to determine whether or not a contact's phone number supports carrier video calling.

See getCapabilities

Value: 256

CAPABILITY_VOICE_CALLING_AVAILABLE

Added in API level 33
static val CAPABILITY_VOICE_CALLING_AVAILABLE: Int

Flag indicating that this PhoneAccount is currently able to place SIM-based voice calls, similar to CAPABILITY_VIDEO_CALLING.

See also CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS, which indicates whether the PhoneAccount supports placing SIM-based voice calls or not.

In order to declare this capability, this PhoneAccount must also declare CAPABILITY_SIM_SUBSCRIPTION or CAPABILITY_CONNECTION_MANAGER and satisfy the associated requirements.

Value: 131072

EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE

Added in API level 31
static val EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE: String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether a Self-managed PhoneAccount want to expose its calls to all InCallService which declares the metadata TelecomManager#METADATA_INCLUDE_SELF_MANAGED_CALLS.

Value: "android.telecom.extra.ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE"

EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE

Added in API level 31
static val EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE: String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates that all calls from this PhoneAccount should be treated as VoIP calls rather than cellular calls by the Telecom audio handling logic.

Value: "android.telecom.extra.ALWAYS_USE_VOIP_AUDIO_MODE"

EXTRA_CALL_SUBJECT_CHARACTER_ENCODING

Added in API level 24
static val EXTRA_CALL_SUBJECT_CHARACTER_ENCODING: String

PhoneAccount extras key (see PhoneAccount#getExtras()) which determines the character encoding to be used when determining the length of messages. The user interface can use this when determining the number of characters the user may type in a call subject. If empty-string, the call subject message size limit will be enforced on a 1:1 basis. That is, each character will count towards the messages size limit as a single character. If a character encoding is specified, the message size limit will be based on the number of bytes in the message per the specified encoding. See EXTRA_CALL_SUBJECT_MAX_LENGTH for more information on the call subject maximum length.

Value: "android.telecom.extra.CALL_SUBJECT_CHARACTER_ENCODING"

EXTRA_CALL_SUBJECT_MAX_LENGTH

Added in API level 24
static val EXTRA_CALL_SUBJECT_MAX_LENGTH: String

PhoneAccount extras key (see PhoneAccount#getExtras()) which determines the maximum permitted length of a call subject specified via the TelecomManager#EXTRA_CALL_SUBJECT extra on an android.content.Intent#ACTION_CALL intent. Ultimately a ConnectionService is responsible for enforcing the maximum call subject length when sending the message, however this extra is provided so that the user interface can proactively limit the length of the call subject as the user types it.

Value: "android.telecom.extra.CALL_SUBJECT_MAX_LENGTH"

EXTRA_LOG_SELF_MANAGED_CALLS

Added in API level 28
static val EXTRA_LOG_SELF_MANAGED_CALLS: String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether a Self-Managed PhoneAccount should log its calls to the call log. Self-Managed PhoneAccounts are responsible for their own notifications, so the system will not create a notification when a missed call is logged.

By default, Self-Managed PhoneAccounts do not log their calls to the call log. Setting this extra to true provides a means for them to log their calls.

Note: Only calls where the Call.Details#getHandle() Uri#getScheme() is SCHEME_SIP or SCHEME_TEL will be logged at the current time.

Value: "android.telecom.extra.LOG_SELF_MANAGED_CALLS"

EXTRA_SUPPORTS_HANDOVER_FROM

Added in API level 28
static val EXTRA_SUPPORTS_HANDOVER_FROM: String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether this PhoneAccount is capable of supporting a request to handover a connection from this PhoneAccount to another PhoneAccount. (see android.telecom.Call#handoverTo()) which specifies EXTRA_SUPPORTS_HANDOVER_TO.

A handover request is initiated by the user from the default dialer app to indicate a desire to handover a call from one PhoneAccount/ConnectionService to another.

Value: "android.telecom.extra.SUPPORTS_HANDOVER_FROM"

EXTRA_SUPPORTS_HANDOVER_TO

Added in API level 28
static val EXTRA_SUPPORTS_HANDOVER_TO: String

Boolean PhoneAccount extras key (see PhoneAccount#getExtras()) which indicates whether this PhoneAccount is capable of supporting a request to handover a connection (see android.telecom.Call#handoverTo()) to this PhoneAccount from a PhoneAccount specifying EXTRA_SUPPORTS_HANDOVER_FROM.

A handover request is initiated by the user from the default dialer app to indicate a desire to handover a call from one PhoneAccount/ConnectionService to another.

Value: "android.telecom.extra.SUPPORTS_HANDOVER_TO"

NO_HIGHLIGHT_COLOR

Added in API level 23
static val NO_HIGHLIGHT_COLOR: Int

Indicating no hightlight color is set.

Value: 0

NO_RESOURCE_ID

Added in API level 23
static val NO_RESOURCE_ID: Int

Indicating no resource ID is set.

Value: -1

SCHEME_SIP

Added in API level 23
static val SCHEME_SIP: String

URI scheme for SIP URIs.

Value: "sip"

SCHEME_TEL

Added in API level 23
static val SCHEME_TEL: String

URI scheme for telephone number URIs.

Value: "tel"

SCHEME_VOICEMAIL

Added in API level 23
static val SCHEME_VOICEMAIL: String

URI scheme for voicemail URIs.

Value: "voicemail"

Public methods

builder

Added in API level 23
static fun builder(
    accountHandle: PhoneAccountHandle!,
    label: CharSequence!
): PhoneAccount.Builder!

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.

getAccountHandle

Added in API level 23
fun getAccountHandle(): PhoneAccountHandle!

The unique identifier of this PhoneAccount.

Return
PhoneAccountHandle! A PhoneAccountHandle.

getAddress

Added in API level 23
fun getAddress(): Uri!

The address (e.g., a phone number) associated with this PhoneAccount. This represents the destination from which outgoing calls using this PhoneAccount will appear to come, if applicable, and the destination to which incoming calls using this PhoneAccount may be addressed.

Return
Uri! A address expressed as a Uri, for example, a phone number.

getCapabilities

Added in API level 23
fun getCapabilities(): Int

The capabilities of this PhoneAccount.

Return
Int A bit field of flags describing this PhoneAccount's capabilities.

getExtras

Added in API level 24
fun getExtras(): Bundle!

The extras associated with this PhoneAccount.

A ConnectionService may provide implementation specific information about the PhoneAccount via the extras.

Return
Bundle! The extras.

getHighlightColor

Added in API level 23
fun getHighlightColor(): Int

A highlight color to use in displaying information about this PhoneAccount.

Return
Int A hexadecimal color value.

getIcon

Added in API level 23
fun getIcon(): Icon!

The icon to represent this PhoneAccount.

Return
Icon! The icon.

getLabel

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

A short label describing a PhoneAccount.

Return
CharSequence! A label for this PhoneAccount.

getShortDescription

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

A short paragraph describing this PhoneAccount.

Return
CharSequence! A description for this PhoneAccount.

getSubscriptionAddress

Added in API level 23
fun getSubscriptionAddress(): Uri!

The raw callback number used for this PhoneAccount, as distinct from getAddress(). For the majority of PhoneAccounts this should be registered as null. It is used by the system for SIM-based PhoneAccount registration where android.telephony.TelephonyManager#setLine1NumberForDisplay(String, String) has been used to alter the callback number.

Return
Uri! The subscription number, suitable for display to the user.

getSupportedUriSchemes

Added in API level 23
fun getSupportedUriSchemes(): MutableList<String!>!

The URI schemes supported by this PhoneAccount.

Return
MutableList<String!>! The URI schemes.

hasCapabilities

Added in API level 23
fun hasCapabilities(capability: Int): Boolean

Determines if this PhoneAccount has a capabilities specified by the passed in bit mask.

Parameters
capability Int: The capabilities to check.
Return
Boolean true if the phone account has the capability.

hashCode

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

isEnabled

Added in API level 23
fun isEnabled(): Boolean

Indicates whether the user has enabled this PhoneAccount or not. This value is only populated for PhoneAccounts returned by TelecomManager#getPhoneAccount.

Return
Boolean true if the account is enabled by the user, false otherwise.

supportsUriScheme

Added in API level 23
fun supportsUriScheme(uriScheme: String!): Boolean

Determines if the PhoneAccount supports calls to/from addresses with a specified URI scheme.

Parameters
uriScheme String!: The URI scheme to check.
Return
Boolean true if the PhoneAccount supports calls to/from addresses with the specified URI scheme.

toBuilder

Added in API level 23
fun toBuilder(): PhoneAccount.Builder!

Returns a builder initialized with the current PhoneAccount instance.

Return
PhoneAccount.Builder! The builder.

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(
    out: 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<PhoneAccount!>