Android APIs
public final class

PhoneAccount

extends Object
implements Parcelable
java.lang.Object
   ↳ android.telecom.PhoneAccount

Class Overview

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
class PhoneAccount.Builder Helper class for creating a PhoneAccount
Constants
int CAPABILITY_CALL_PROVIDER Flag indicating that this PhoneAccount can make phone calls in place of traditional SIM-based telephony calls.
int CAPABILITY_CALL_SUBJECT Flag indicating that this PhoneAccount supports a subject for Calls.
int CAPABILITY_CONNECTION_MANAGER Flag indicating that this PhoneAccount can act as a connection manager for other connections.
int CAPABILITY_PLACE_EMERGENCY_CALLS Flag indicating that this PhoneAccount is capable of placing emergency calls.
int CAPABILITY_SIM_SUBSCRIPTION Flag indicating that this PhoneAccount represents a built-in PSTN SIM subscription.
int CAPABILITY_VIDEO_CALLING Flag indicating that this PhoneAccount is capable of placing video calls.
int NO_HIGHLIGHT_COLOR Indicating no hightlight color is set.
int NO_RESOURCE_ID Indicating no resource ID is set.
String SCHEME_SIP URI scheme for SIP URIs.
String SCHEME_TEL URI scheme for telephone number URIs.
String SCHEME_VOICEMAIL URI scheme for voicemail URIs.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<PhoneAccount> CREATOR
Public Methods
static PhoneAccount.Builder builder(PhoneAccountHandle accountHandle, CharSequence label)
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
PhoneAccountHandle getAccountHandle()
The unique identifier of this PhoneAccount.
Uri getAddress()
The address (e.g., a phone number) associated with this PhoneAccount.
int getCapabilities()
The capabilities of this PhoneAccount.
int getHighlightColor()
A highlight color to use in displaying information about this PhoneAccount.
Icon getIcon()
The icon to represent this PhoneAccount.
CharSequence getLabel()
A short label describing a PhoneAccount.
CharSequence getShortDescription()
A short paragraph describing this PhoneAccount.
Uri getSubscriptionAddress()
The raw callback number used for this PhoneAccount, as distinct from getAddress().
List<String> getSupportedUriSchemes()
The URI schemes supported by this PhoneAccount.
boolean hasCapabilities(int capability)
Determines if this PhoneAccount has a capabilities specified by the passed in bit mask.
boolean isEnabled()
Indicates whether the user has enabled this PhoneAccount or not.
boolean supportsUriScheme(String uriScheme)
Determines if the PhoneAccount supports calls to/from addresses with a specified URI scheme.
PhoneAccount.Builder toBuilder()
Returns a builder initialized with the current PhoneAccount instance.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int CAPABILITY_CALL_PROVIDER

Added in API level 23

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()

Constant Value: 2 (0x00000002)

public static final int CAPABILITY_CALL_SUBJECT

Added in API level 23

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()

Constant Value: 64 (0x00000040)

public static final int CAPABILITY_CONNECTION_MANAGER

Added in API level 23

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()

Constant Value: 1 (0x00000001)

public static final int CAPABILITY_PLACE_EMERGENCY_CALLS

Added in API level 23

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

See getCapabilities()

Constant Value: 16 (0x00000010)

public static final int CAPABILITY_SIM_SUBSCRIPTION

Added in API level 23

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()

Constant Value: 4 (0x00000004)

public static final int CAPABILITY_VIDEO_CALLING

Added in API level 23

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

See getCapabilities()

Constant Value: 8 (0x00000008)

public static final int NO_HIGHLIGHT_COLOR

Added in API level 23

Indicating no hightlight color is set.

Constant Value: 0 (0x00000000)

public static final int NO_RESOURCE_ID

Added in API level 23

Indicating no resource ID is set.

Constant Value: -1 (0xffffffff)

public static final String SCHEME_SIP

Added in API level 23

URI scheme for SIP URIs.

Constant Value: "sip"

public static final String SCHEME_TEL

Added in API level 23

URI scheme for telephone number URIs.

Constant Value: "tel"

public static final String SCHEME_VOICEMAIL

Added in API level 23

URI scheme for voicemail URIs.

Constant Value: "voicemail"

Fields

public static final Creator<PhoneAccount> CREATOR

Added in API level 23

Public Methods

public static PhoneAccount.Builder builder (PhoneAccountHandle accountHandle, CharSequence label)

Added in API level 23

public int describeContents ()

Added in API level 23

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public PhoneAccountHandle getAccountHandle ()

Added in API level 23

The unique identifier of this PhoneAccount.

Returns
  • A PhoneAccountHandle.

public Uri getAddress ()

Added in API level 23

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.

Returns
  • A address expressed as a Uri, for example, a phone number.

public int getCapabilities ()

Added in API level 23

The capabilities of this PhoneAccount.

Returns
  • A bit field of flags describing this PhoneAccount's capabilities.

public int getHighlightColor ()

Added in API level 23

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

Returns
  • A hexadecimal color value.

public Icon getIcon ()

Added in API level 23

The icon to represent this PhoneAccount.

Returns
  • The icon.

public CharSequence getLabel ()

Added in API level 23

A short label describing a PhoneAccount.

Returns
  • A label for this PhoneAccount.

public CharSequence getShortDescription ()

Added in API level 23

A short paragraph describing this PhoneAccount.

Returns
  • A description for this PhoneAccount.

public Uri getSubscriptionAddress ()

Added in API level 23

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 setLine1NumberForDisplay(String, String) has been used to alter the callback number.

Returns
  • The subscription number, suitable for display to the user.

public List<String> getSupportedUriSchemes ()

Added in API level 23

The URI schemes supported by this PhoneAccount.

Returns
  • The URI schemes.

public boolean hasCapabilities (int capability)

Added in API level 23

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

Parameters
capability The capabilities to check.
Returns
  • true if the phone account has the capability.

public boolean isEnabled ()

Added in API level 23

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

Returns
  • true if the account is enabled by the user, false otherwise.

public boolean supportsUriScheme (String uriScheme)

Added in API level 23

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

Parameters
uriScheme The URI scheme to check.
Returns
  • true if the PhoneAccount supports calls to/from addresses with the specified URI scheme.

public PhoneAccount.Builder toBuilder ()

Added in API level 23

Returns a builder initialized with the current PhoneAccount instance.

Returns
  • The builder.

public String toString ()

Added in API level 23

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel out, int flags)

Added in API level 23

Flatten this object in to a Parcel.

Parameters
out The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.