FileDocCategorySizeDatePackage
TelecomManager.javaAPI DocAndroid 5.1 API38867Thu Mar 12 22:22:42 GMT 2015android.telecom

TelecomManager

public class TelecomManager extends Object
Provides access to information about active calls and registration/call-management functionality. Apps can use methods in this class to determine the current call state.

Apps do not instantiate this class directly; instead, they retrieve a reference to an instance through {@link Context#getSystemService Context.getSystemService(Context.TELECOM_SERVICE)}.

Note that access to some telecom information is permission-protected. Your app cannot access the protected information or gain access to protected functionality unless it has the appropriate permissions declared in its manifest file. Where permissions apply, they are noted in the method descriptions.

Fields Summary
public static final String
ACTION_INCOMING_CALL
Activity action: Starts the UI for handing an incoming call. This intent starts the in-call UI by notifying the Telecom system that an incoming call exists for a specific call service (see {@link android.telecom.ConnectionService}). Telecom reads the Intent extras to find and bind to the appropriate {@link android.telecom.ConnectionService} which Telecom will ultimately use to control and get information about the call.

Input: get*Extra field {@link #EXTRA_PHONE_ACCOUNT_HANDLE} contains the component name of the {@link android.telecom.ConnectionService} that Telecom should bind to. Telecom will then ask the connection service for more information about the call prior to showing any UI.

public static final String
ACTION_NEW_UNKNOWN_CALL
Similar to {@link #ACTION_INCOMING_CALL}, but is used only by Telephony to add a new sim-initiated MO call for carrier testing.
public static final String
ACTION_CONNECTION_SERVICE_CONFIGURE
The {@link android.content.Intent} action used to configure a {@link android.telecom.ConnectionService}.
public static final String
ACTION_SHOW_CALL_SETTINGS
The {@link android.content.Intent} action used to show the call settings page.
public static final String
ACTION_CHANGE_PHONE_ACCOUNTS
The {@link android.content.Intent} action used to show the settings page used to configure {@link PhoneAccount} preferences.
public static final String
EXTRA_START_CALL_WITH_SPEAKERPHONE
Optional extra for {@link android.content.Intent#ACTION_CALL} containing a boolean that determines whether the speakerphone should be automatically turned on for an outgoing call.
public static final String
EXTRA_START_CALL_WITH_VIDEO_STATE
Optional extra for {@link android.content.Intent#ACTION_CALL} containing an integer that determines the desired video state for an outgoing call. Valid options: {@link VideoProfile.VideoState#AUDIO_ONLY}, {@link VideoProfile.VideoState#BIDIRECTIONAL}, {@link VideoProfile.VideoState#RX_ENABLED}, {@link VideoProfile.VideoState#TX_ENABLED}.
public static final String
EXTRA_PHONE_ACCOUNT_HANDLE
The extra used with an {@link android.content.Intent#ACTION_CALL} and {@link android.content.Intent#ACTION_DIAL} {@code Intent} to specify a {@link PhoneAccountHandle} to use when making the call.

Retrieve with {@link android.content.Intent#getParcelableExtra(String)}.

public static final String
EXTRA_INCOMING_CALL_EXTRAS
Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains metadata about the call. This {@link Bundle} will be returned to the {@link ConnectionService}.
public static final String
EXTRA_OUTGOING_CALL_EXTRAS
Optional extra for {@link android.content.Intent#ACTION_CALL} and {@link android.content.Intent#ACTION_DIAL} {@code Intent} containing a {@link Bundle} which contains metadata about the call. This {@link Bundle} will be saved into {@code Call.Details}.
public static final String
EXTRA_UNKNOWN_CALL_HANDLE
public static final String
EXTRA_CALL_DISCONNECT_CAUSE
Optional extra for {@link android.telephony.TelephonyManager#ACTION_PHONE_STATE_CHANGED} containing the disconnect code.
public static final String
EXTRA_CALL_DISCONNECT_MESSAGE
Optional extra for {@link android.telephony.TelephonyManager#ACTION_PHONE_STATE_CHANGED} containing the disconnect message.
public static final String
EXTRA_CONNECTION_SERVICE
Optional extra for {@link android.telephony.TelephonyManager#ACTION_PHONE_STATE_CHANGED} containing the component name of the associated connection service.
public static final String
GATEWAY_PROVIDER_PACKAGE
An optional {@link android.content.Intent#ACTION_CALL} intent extra denoting the package name of the app specifying an alternative gateway for the call. The value is a string. (The following comment corresponds to the all GATEWAY_* extras) An app which sends the {@link android.content.Intent#ACTION_CALL} intent can specify an alternative address to dial which is different from the one specified and displayed to the user. This alternative address is referred to as the gateway address.
public static final String
GATEWAY_ORIGINAL_ADDRESS
An optional {@link android.content.Intent#ACTION_CALL} intent extra corresponding to the original address to dial for the call. This is used when an alternative gateway address is provided to recall the original address. The value is a {@link android.net.Uri}. (See {@link #GATEWAY_PROVIDER_PACKAGE} for details)
public static final String
EXTRA_CALL_BACK_NUMBER
The number which the party on the other side of the line will see (and use to return the call).

{@link ConnectionService}s which interact with {@link RemoteConnection}s should only populate this if the {@link android.telephony.TelephonyManager#getLine1Number()} value, as that is the user's expected caller ID.

public static final char
DTMF_CHARACTER_PAUSE
The dual tone multi-frequency signaling character sent to indicate the dialing system should pause for a predefined period.
public static final char
DTMF_CHARACTER_WAIT
The dual-tone multi-frequency signaling character sent to indicate the dialing system should wait for user confirmation before proceeding.
public static final int
TTY_MODE_OFF
TTY (teletypewriter) mode is off.
public static final int
TTY_MODE_FULL
TTY (teletypewriter) mode is on. The speaker is off and the microphone is muted. The user will communicate with the remote party by sending and receiving text messages.
public static final int
TTY_MODE_HCO
TTY (teletypewriter) mode is in hearing carryover mode (HCO). The microphone is muted but the speaker is on. The user will communicate with the remote party by sending text messages and hearing an audible reply.
public static final int
TTY_MODE_VCO
TTY (teletypewriter) mode is in voice carryover mode (VCO). The speaker is off but the microphone is still on. User will communicate with the remote party by speaking and receiving text message replies.
public static final String
ACTION_CURRENT_TTY_MODE_CHANGED
Broadcast intent action indicating that the current TTY mode has changed. An intent extra provides this state as an int.
public static final String
EXTRA_CURRENT_TTY_MODE
The lookup key for an int that indicates the current TTY mode. Valid modes are: - {@link #TTY_MODE_OFF} - {@link #TTY_MODE_FULL} - {@link #TTY_MODE_HCO} - {@link #TTY_MODE_VCO}
public static final String
ACTION_TTY_PREFERRED_MODE_CHANGED
Broadcast intent action indicating that the TTY preferred operating mode has changed. An intent extra provides the new mode as an int.
public static final String
EXTRA_TTY_PREFERRED_MODE
The lookup key for an int that indicates preferred TTY mode. Valid modes are: - {@link #TTY_MODE_OFF} - {@link #TTY_MODE_FULL} - {@link #TTY_MODE_HCO} - {@link #TTY_MODE_VCO}
public static final int
PRESENTATION_ALLOWED
Property is displayed normally.
public static final int
PRESENTATION_RESTRICTED
Property was blocked.
public static final int
PRESENTATION_UNKNOWN
Presentation was not specified or is unknown.
public static final int
PRESENTATION_PAYPHONE
Property should be displayed as a pay phone.
private static final String
TAG
private final android.content.Context
mContext
Constructors Summary
public TelecomManager(android.content.Context context)

hide

        Context appContext = context.getApplicationContext();
        if (appContext != null) {
            mContext = appContext;
        } else {
            mContext = context;
        }
    
Methods Summary
public voidacceptRingingCall()
If there is a ringing incoming call, this method accepts the call on behalf of the user. TODO: L-release - need to convert all invocation of ITelecmmService#answerRingingCall to use this method (clockwork & gearhead).

hide

        try {
            if (isServiceConnected()) {
                getTelecomService().acceptRingingCall();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#acceptRingingCall", e);
        }
    
public voidaddNewIncomingCall(PhoneAccountHandle phoneAccount, android.os.Bundle extras)
Registers a new incoming call. A {@link ConnectionService} should invoke this method when it has an incoming call. The specified {@link PhoneAccountHandle} must have been registered with {@link #registerPhoneAccount}. Once invoked, this method will cause the system to bind to the {@link ConnectionService} associated with the {@link PhoneAccountHandle} and request additional information about the call (See {@link ConnectionService#onCreateIncomingConnection}) before starting the incoming call UI.

param
phoneAccount A {@link PhoneAccountHandle} registered with {@link #registerPhoneAccount}.
param
extras A bundle that will be passed through to {@link ConnectionService#onCreateIncomingConnection}.
hide

        try {
            if (isServiceConnected()) {
                getTelecomService().addNewIncomingCall(
                        phoneAccount, extras == null ? new Bundle() : extras);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException adding a new incoming call: " + phoneAccount, e);
        }
    
public voidaddNewUnknownCall(PhoneAccountHandle phoneAccount, android.os.Bundle extras)
Registers a new unknown call with Telecom. This can only be called by the system Telephony service. This is invoked when Telephony detects a new unknown connection that was neither a new incoming call, nor an user-initiated outgoing call.

param
phoneAccount A {@link PhoneAccountHandle} registered with {@link #registerPhoneAccount}.
param
extras A bundle that will be passed through to {@link ConnectionService#onCreateIncomingConnection}.
hide

        try {
            if (isServiceConnected()) {
                getTelecomService().addNewUnknownCall(
                        phoneAccount, extras == null ? new Bundle() : extras);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException adding a new unknown call: " + phoneAccount, e);
        }
    
public voidcancelMissedCallsNotification()
Removes the missed-call notification if one is present.

Requires that the method-caller be set as the system dialer app.

        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                service.cancelMissedCallsNotification();
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#cancelMissedCallsNotification", e);
            }
        }
    
public voidclearAccounts()
Remove all Accounts that belong to the calling package from the system.

hide

        try {
            if (isServiceConnected()) {
                getTelecomService().clearAccounts(mContext.getPackageName());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#clearAccounts", e);
        }
    
public voidclearAccountsForPackage(java.lang.String packageName)
Remove all Accounts that belong to the specified package from the system.

hide

        try {
            if (isServiceConnected() && !TextUtils.isEmpty(packageName)) {
                getTelecomService().clearAccounts(packageName);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#clearAccountsForPackage", e);
        }
    
public booleanendCall()
Ends an ongoing call. TODO: L-release - need to convert all invocations of ITelecomService#endCall to use this method (clockwork & gearhead).

hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().endCall();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#endCall", e);
        }
        return false;
    
public static android.telecom.TelecomManagerfrom(android.content.Context context)

hide


          
         
        return (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
    
public android.net.UrigetAdnUriForPhoneAccount(PhoneAccountHandle accountHandle)

param
accountHandle The handle for the account to derive an adn query URI for or {@code null} to return a URI which will use the default account.
return
The URI (with the content:// scheme) specific to the specified {@link PhoneAccount} for the the content retrieve.
hide

        ITelecomService service = getTelecomService();
        if (service != null && accountHandle != null) {
            try {
                return service.getAdnUriForPhoneAccount(accountHandle);
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#getAdnUriForPhoneAccount", e);
            }
        }
        return Uri.parse("content://icc/adn");
    
public java.util.ListgetAllPhoneAccountHandles()
Returns a list of all {@link PhoneAccountHandle}s.

return
All {@link PhoneAccountHandle}s.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getAllPhoneAccountHandles();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getAllPhoneAccountHandles", e);
        }
        return Collections.EMPTY_LIST;
    
public java.util.ListgetAllPhoneAccounts()
Returns a list of all {@link PhoneAccount}s.

return
All {@link PhoneAccount}s.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getAllPhoneAccounts();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getAllPhoneAccounts", e);
        }
        return Collections.EMPTY_LIST;
    
public intgetAllPhoneAccountsCount()
Returns a count of all {@link PhoneAccount}s.

return
The count of {@link PhoneAccount}s.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getAllPhoneAccountsCount();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getAllPhoneAccountsCount", e);
        }
        return 0;
    
public java.util.ListgetCallCapablePhoneAccounts()
Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone calls.

see
#EXTRA_PHONE_ACCOUNT_HANDLE
return
A list of {@code PhoneAccountHandle} objects.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getCallCapablePhoneAccounts();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
        }
        return new ArrayList<>();
    
public intgetCallState()
Returns one of the following constants that represents the current state of Telecom: {@link TelephonyManager#CALL_STATE_RINGING} {@link TelephonyManager#CALL_STATE_OFFHOOK} {@link TelephonyManager#CALL_STATE_IDLE} Note that this API does not require the {@link android.Manifest.permission#READ_PHONE_STATE} permission. This is intentional, to preserve the behavior of {@link TelephonyManager#getCallState()}, which also did not require the permission.

hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getCallState();
            }
        } catch (RemoteException e) {
            Log.d(TAG, "RemoteException calling getCallState().", e);
        }
        return TelephonyManager.CALL_STATE_IDLE;
    
public PhoneAccountHandlegetConnectionManager()
Returns the current connection manager. Apps must be prepared for this method to return {@code null}, indicating that there currently exists no user-chosen default {@code PhoneAccount}.

return
The phone account handle of the current connection manager.
hide

        return getSimCallManager();
    
public intgetCurrentTtyMode()
Returns the current TTY mode of the device. For TTY to be on the user must enable it in settings and have a wired headset plugged in. Valid modes are: - {@link TelecomManager#TTY_MODE_OFF} - {@link TelecomManager#TTY_MODE_FULL} - {@link TelecomManager#TTY_MODE_HCO} - {@link TelecomManager#TTY_MODE_VCO}

hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getCurrentTtyMode();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException attempting to get the current TTY mode.", e);
        }
        return TTY_MODE_OFF;
    
public PhoneAccountHandlegetDefaultOutgoingPhoneAccount(java.lang.String uriScheme)
Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone calls with a specified URI scheme.

Apps must be prepared for this method to return {@code null}, indicating that there currently exists no user-chosen default {@code PhoneAccount}.

param
uriScheme The URI scheme.
return
The {@link PhoneAccountHandle} corresponding to the user-chosen default for outgoing phone calls for a specified URI scheme.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getDefaultOutgoingPhoneAccount(uriScheme);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getDefaultOutgoingPhoneAccount", e);
        }
        return null;
    
public android.content.ComponentNamegetDefaultPhoneApp()

hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getDefaultPhoneApp();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException attempting to get the default phone app.", e);
        }
        return null;
    
public java.lang.StringgetLine1Number(PhoneAccountHandle accountHandle)
Return the line 1 phone number for given phone account.

param
accountHandle The handle for the account retrieve a number for.
return
A string representation of the line 1 phone number.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getLine1Number(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling ITelecomService#getLine1Number.", e);
        }
        return null;
    
public PhoneAccountgetPhoneAccount(PhoneAccountHandle account)
Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes resources which can be used in a user interface.

param
account The {@link PhoneAccountHandle}.
return
The {@link PhoneAccount} object.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getPhoneAccount(account);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getPhoneAccount", e);
        }
        return null;
    
public java.util.ListgetPhoneAccountsForPackage()
Returns a list of all {@link PhoneAccount}s registered for the calling package.

return
A list of {@code PhoneAccountHandle} objects.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getPhoneAccountsForPackage(mContext.getPackageName());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsForPackage", e);
        }
        return null;
    
public java.util.ListgetPhoneAccountsSupportingScheme(java.lang.String uriScheme)
Returns a list of the {@link PhoneAccountHandle}s which can be used to make and receive phone calls which support the specified URI scheme.

For example, invoking with {@code "tel"} will find all {@link PhoneAccountHandle}s which support telephone calls (e.g. URIs such as {@code tel:555-555-1212}). Invoking with {@code "sip"} will find all {@link PhoneAccountHandle}s which support SIP calls (e.g. URIs such as {@code sip:example@sipexample.com}).

param
uriScheme The URI scheme.
return
A list of {@code PhoneAccountHandle} objects supporting the URI scheme.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getPhoneAccountsSupportingScheme(uriScheme);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsSupportingScheme", e);
        }
        return new ArrayList<>();
    
public java.util.ListgetRegisteredConnectionManagers()
Returns the list of registered SIM call managers.

return
List of registered SIM call managers.
hide

        return getSimCallManagers();
    
public PhoneAccountHandlegetSimCallManager()
Returns the current SIM call manager. Apps must be prepared for this method to return {@code null}, indicating that there currently exists no user-chosen default {@code PhoneAccount}.

return
The phone account handle of the current sim call manager.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getSimCallManager();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getSimCallManager");
        }
        return null;
    
public java.util.ListgetSimCallManagers()
Returns the list of registered SIM call managers.

return
List of registered SIM call managers.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getSimCallManagers();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getSimCallManagers");
        }
        return new ArrayList<>();
    
private com.android.internal.telecom.ITelecomServicegetTelecomService()

        return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
    
public PhoneAccountHandlegetUserSelectedOutgoingPhoneAccount()
Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone calls. This {@code PhoneAccount} will always be a member of the list which is returned from calling {@link #getCallCapablePhoneAccounts()} Apps must be prepared for this method to return {@code null}, indicating that there currently exists no user-chosen default {@code PhoneAccount}.

return
The user outgoing phone account selected by the user.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().getUserSelectedOutgoingPhoneAccount();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getUserSelectedOutgoingPhoneAccount", e);
        }
        return null;
    
public booleanhandleMmi(java.lang.String dialString)
Processes the specified dial string as an MMI code. MMI codes are any sequence of characters entered into the dialpad that contain a "*" or "#". Some of these sequences launch special behavior through handled by Telephony. This method uses the default subscription.

Requires that the method-caller be set as the system dialer app.

param
dialString The digits to dial.
return
True if the digits were processed as an MMI code, false otherwise.

        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                return service.handlePinMmi(dialString);
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#handlePinMmi", e);
            }
        }
        return false;
    
public booleanhandleMmi(PhoneAccountHandle accountHandle, java.lang.String dialString)
Processes the specified dial string as an MMI code. MMI codes are any sequence of characters entered into the dialpad that contain a "*" or "#". Some of these sequences launch special behavior through handled by Telephony.

Requires that the method-caller be set as the system dialer app.

param
accountHandle The handle for the account the MMI code should apply to.
param
dialString The digits to dial.
return
True if the digits were processed as an MMI code, false otherwise.
hide

        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                return service.handlePinMmiForPhoneAccount(accountHandle, dialString);
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#handlePinMmi", e);
            }
        }
        return false;
    
public booleanhasMultipleCallCapableAccounts()
Determine whether the device has more than one account registered that can make and receive phone calls.

return
{@code true} if the device has more than one account registered and {@code false} otherwise.
hide

        return getCallCapablePhoneAccounts().size() > 1;
    
public booleanhasVoiceMailNumber(PhoneAccountHandle accountHandle)
Return whether a given phone account has a voicemail number configured.

param
accountHandle The handle for the account to check for a voicemail number.
return
{@code true} If the given phone account has a voicemail number.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().hasVoiceMailNumber(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling ITelecomService#hasVoiceMailNumber.", e);
        }
        return false;
    
public booleanisInCall()
Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding states).

Requires permission: {@link android.Manifest.permission#READ_PHONE_STATE}

        try {
            if (isServiceConnected()) {
                return getTelecomService().isInCall();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling isInCall().", e);
        }
        return false;
    
public booleanisRinging()
Returns whether there currently exists is a ringing incoming-call.

hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().isRinging();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException attempting to get ringing state of phone app.", e);
        }
        return false;
    
private booleanisServiceConnected()

        boolean isConnected = getTelecomService() != null;
        if (!isConnected) {
            Log.w(TAG, "Telecom Service not found.");
        }
        return isConnected;
    
public booleanisTtySupported()
Returns whether TTY is supported on this device.

hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().isTtySupported();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException attempting to get TTY supported state.", e);
        }
        return false;
    
public booleanisVoiceMailNumber(PhoneAccountHandle accountHandle, java.lang.String number)
Return whether a given phone number is the configured voicemail number for a particular phone account.

param
accountHandle The handle for the account to check the voicemail number against
param
number The number to look up.
hide

        try {
            if (isServiceConnected()) {
                return getTelecomService().isVoiceMailNumber(accountHandle, number);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling ITelecomService#isVoiceMailNumber.", e);
        }
        return false;
    
public voidregisterPhoneAccount(PhoneAccount account)
Register a {@link PhoneAccount} for use by the system. When registering {@link PhoneAccount}s, existing registrations will be overwritten if the {@link PhoneAccountHandle} matches that of a {@link PhoneAccount} which is already registered. Once registered, the {@link PhoneAccount} is listed to the user as an option when placing calls. The user may still need to enable the {@link PhoneAccount} within the phone app settings before the account is usable.

A {@link SecurityException} will be thrown if an app tries to register a {@link PhoneAccountHandle} where the package name specified within {@link PhoneAccountHandle#getComponentName()} does not match the package name of the app.

param
account The complete {@link PhoneAccount}.
hide

        try {
            if (isServiceConnected()) {
                getTelecomService().registerPhoneAccount(account);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#registerPhoneAccount", e);
        }
    
public voidsetSimCallManager(PhoneAccountHandle accountHandle)
Sets the SIM call manager to the specified phone account.

param
accountHandle The phone account handle of the account to set as the sim call manager.
hide

        try {
            if (isServiceConnected()) {
                getTelecomService().setSimCallManager(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#setSimCallManager");
        }
    
public voidsetUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle)
Sets the default account for making outgoing phone calls.

hide

        try {
            if (isServiceConnected()) {
                getTelecomService().setUserSelectedOutgoingPhoneAccount(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#setUserSelectedOutgoingPhoneAccount");
        }
    
public voidshowInCallScreen(boolean showDialpad)
Brings the in-call screen to the foreground if there is an ongoing call. If there is currently no ongoing call, then this method does nothing.

Requires that the method-caller be set as the system dialer app or have the {@link android.Manifest.permission#READ_PHONE_STATE} permission.

param
showDialpad Brings up the in-call dialpad as part of showing the in-call screen.

        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                service.showInCallScreen(showDialpad);
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#showCallScreen", e);
            }
        }
    
public voidsilenceRinger()
Silences the ringer if a ringing call exists.

hide

        try {
            if (isServiceConnected()) {
                getTelecomService().silenceRinger();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#silenceRinger", e);
        }
    
public voidunregisterPhoneAccount(PhoneAccountHandle accountHandle)
Remove a {@link PhoneAccount} registration from the system.

param
accountHandle A {@link PhoneAccountHandle} for the {@link PhoneAccount} to unregister.
hide

        try {
            if (isServiceConnected()) {
                getTelecomService().unregisterPhoneAccount(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#unregisterPhoneAccount", e);
        }