# Print output for @column tags ?>
public
class
TelecomManager
extends Object
java.lang.Object | |
↳ | android.telecom.TelecomManager |
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 Context#getSystemService
.
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.
Constants | |
---|---|
String |
ACTION_CHANGE_DEFAULT_DIALER
Activity action: Shows a dialog asking the user whether or not they want to replace the
current default Dialer with the one specified in
|
String |
ACTION_CHANGE_PHONE_ACCOUNTS
The |
String |
ACTION_CONFIGURE_PHONE_ACCOUNT
An |
String |
ACTION_DEFAULT_CALL_SCREENING_APP_CHANGED
Broadcast intent action indicating that the current default call screening app has changed. |
String |
ACTION_DEFAULT_DIALER_CHANGED
Broadcast intent action indicating that the current default dialer has changed. |
String |
ACTION_INCOMING_CALL
This constant is deprecated.
Use |
String |
ACTION_PHONE_ACCOUNT_REGISTERED
|
String |
ACTION_PHONE_ACCOUNT_UNREGISTERED
|
String |
ACTION_POST_CALL
Start an activity indicating that the completion of an outgoing call or an incoming call
which was not blocked by the |
String |
ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS
The |
String |
ACTION_SHOW_CALL_SETTINGS
The |
String |
ACTION_SHOW_MISSED_CALLS_NOTIFICATION
Broadcast intent action for letting custom component know to show the missed call notification. |
String |
ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS
The |
char |
DTMF_CHARACTER_PAUSE
The dual tone multi-frequency signaling character sent to indicate the dialing system should pause for a predefined period. |
char |
DTMF_CHARACTER_WAIT
The dual-tone multi-frequency signaling character sent to indicate the dialing system should wait for user confirmation before proceeding. |
int |
DURATION_LONG
A integer value for |
int |
DURATION_MEDIUM
A integer value for |
int |
DURATION_SHORT
A integer value for |
int |
DURATION_VERY_SHORT
A integer value for |
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). |
String |
EXTRA_CALL_DISCONNECT_CAUSE
Optional extra for |
String |
EXTRA_CALL_DISCONNECT_MESSAGE
Optional extra for |
String |
EXTRA_CALL_DURATION
A integer value provided for completed calls to indicate the duration of the call. |
String |
EXTRA_CALL_NETWORK_TYPE
Optional extra for communicating the call network technology used by a
|
String |
EXTRA_CALL_SUBJECT
Optional extra for |
String |
EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
Extra value used to provide the package name for |
String |
EXTRA_DEFAULT_CALL_SCREENING_APP_COMPONENT_NAME
Extra value used with |
String |
EXTRA_DISCONNECT_CAUSE
A integer value provided for completed calls to indicate the reason for the call disconnection. |
String |
EXTRA_HANDLE
A |
String |
EXTRA_INCOMING_CALL_ADDRESS
The extra used by a |
String |
EXTRA_INCOMING_CALL_EXTRAS
Optional extra for |
String |
EXTRA_INCOMING_VIDEO_STATE
Optional extra for |
String |
EXTRA_IS_DEFAULT_CALL_SCREENING_APP
Extra value used with |
String |
EXTRA_NOTIFICATION_COUNT
The number of calls associated with the notification. |
String |
EXTRA_NOTIFICATION_PHONE_NUMBER
The number associated with the missed calls. |
String |
EXTRA_OUTGOING_CALL_EXTRAS
Optional extra for |
String |
EXTRA_PHONE_ACCOUNT_HANDLE
The extra used with an |
String |
EXTRA_START_CALL_WITH_RTT
A boolean extra, which when set on the |
String |
EXTRA_START_CALL_WITH_SPEAKERPHONE
Optional extra for |
String |
EXTRA_START_CALL_WITH_VIDEO_STATE
Optional extra for |
String |
EXTRA_USE_ASSISTED_DIALING
The boolean indicated by this extra controls whether or not a call is eligible to undergo assisted dialing. |
String |
GATEWAY_ORIGINAL_ADDRESS
An optional |
String |
GATEWAY_PROVIDER_PACKAGE
An optional |
String |
METADATA_INCLUDE_EXTERNAL_CALLS
A boolean meta-data value indicating whether an |
String |
METADATA_INCLUDE_SELF_MANAGED_CALLS
A boolean meta-data value indicating whether an |
String |
METADATA_IN_CALL_SERVICE_CAR_MODE_UI
A boolean meta-data value indicating whether an |
String |
METADATA_IN_CALL_SERVICE_RINGING
A boolean meta-data value indicating whether an |
String |
METADATA_IN_CALL_SERVICE_UI
A boolean meta-data value indicating whether an |
int |
PRESENTATION_ALLOWED
Indicates that the address or number of a call is allowed to be displayed for caller ID. |
int |
PRESENTATION_PAYPHONE
Indicates that the address or number of a call belongs to a pay phone. |
int |
PRESENTATION_RESTRICTED
Indicates that the address or number of a call is blocked by the other party. |
int |
PRESENTATION_UNKNOWN
Indicates that the address or number of a call is not specified or known by the carrier. |
Public methods | |
---|---|
void
|
acceptHandover(Uri srcAddr, int videoState, PhoneAccountHandle destAcct)
Called by an app to indicate that it wishes to accept the handover of an ongoing call to a
|
void
|
acceptRingingCall(int videoState)
This method is deprecated.
Companion apps for wearable devices should use the |
void
|
acceptRingingCall()
This method is deprecated.
Companion apps for wearable devices should use the |
void
|
addNewIncomingCall(PhoneAccountHandle phoneAccount, Bundle extras)
Registers a new incoming call. |
void
|
cancelMissedCallsNotification()
Removes the missed-call notification if one is present. |
Intent
|
createManageBlockedNumbersIntent()
Creates the |
boolean
|
endCall()
This method is deprecated.
Companion apps for wearable devices should use the |
Uri
|
getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle)
Requires permission: |
List<PhoneAccountHandle>
|
getCallCapablePhoneAccounts()
Returns a list of |
String
|
getDefaultDialerPackage()
Used to determine the currently selected default dialer package. |
PhoneAccountHandle
|
getDefaultOutgoingPhoneAccount(String uriScheme)
Return the |
String
|
getLine1Number(PhoneAccountHandle accountHandle)
Return the line 1 phone number for given phone account. |
PhoneAccount
|
getPhoneAccount(PhoneAccountHandle account)
Return the |
List<PhoneAccountHandle>
|
getSelfManagedPhoneAccounts()
Returns a list of |
PhoneAccountHandle
|
getSimCallManager()
Returns the current SIM call manager. |
PhoneAccountHandle
|
getSimCallManagerForSubscription(int subscriptionId)
Returns current SIM call manager for the Telephony Subscription ID specified. |
String
|
getSystemDialerPackage()
Determines the package name of the system-provided default phone app. |
PhoneAccountHandle
|
getUserSelectedOutgoingPhoneAccount()
Return the |
String
|
getVoiceMailNumber(PhoneAccountHandle accountHandle)
Return the voicemail number for a given phone account. |
boolean
|
handleMmi(String dialString)
Processes the specified dial string as an MMI code. |
boolean
|
handleMmi(String dialString, PhoneAccountHandle accountHandle)
Processes the specified dial string as an MMI code. |
boolean
|
isInCall()
Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding
states) originating from either a manager or self-managed |
boolean
|
isInManagedCall()
Returns whether there is an ongoing call originating from a managed
|
boolean
|
isIncomingCallPermitted(PhoneAccountHandle phoneAccountHandle)
Determines whether Telecom would permit an incoming call to be added via the
|
boolean
|
isOutgoingCallPermitted(PhoneAccountHandle phoneAccountHandle)
Determines whether Telecom would permit an outgoing call to be placed via the
|
boolean
|
isTtySupported()
Returns whether TTY is supported on this device. |
boolean
|
isVoiceMailNumber(PhoneAccountHandle accountHandle, String number)
Return whether a given phone number is the configured voicemail number for a particular phone account. |
void
|
placeCall(Uri address, Bundle extras)
Places a new outgoing call to the provided address using the system telecom service with the specified extras. |
void
|
registerPhoneAccount(PhoneAccount account)
Register a |
void
|
showInCallScreen(boolean showDialpad)
Brings the in-call screen to the foreground if there is an ongoing call. |
void
|
silenceRinger()
Silences the ringer if a ringing call exists. |
void
|
unregisterPhoneAccount(PhoneAccountHandle accountHandle)
Remove a |
Inherited methods | |
---|---|
public static final String ACTION_CHANGE_DEFAULT_DIALER
Activity action: Shows a dialog asking the user whether or not they want to replace the
current default Dialer with the one specified in
EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
.
Usage example:
Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER); intent.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getActivity().getPackageName()); startActivity(intent);
This is no longer supported since Q, please use
RoleManager.createRequestRoleIntent(String)
with
RoleManager.ROLE_DIALER
instead.
Constant Value: "android.telecom.action.CHANGE_DEFAULT_DIALER"
public static final String ACTION_CHANGE_PHONE_ACCOUNTS
The Intent
action used to show the settings page used to configure
PhoneAccount
preferences.
Constant Value: "android.telecom.action.CHANGE_PHONE_ACCOUNTS"
public static final String ACTION_CONFIGURE_PHONE_ACCOUNT
An Intent
action sent by the telecom framework to start a
configuration dialog for a registered PhoneAccount
. There is no default dialog
and each app that registers a PhoneAccount
should provide one if desired.
A user can access the list of enabled PhoneAccount
s through the Phone
app's settings menu. For each entry, the settings app will add a click action. When
triggered, the click-action will start this intent along with the extra
EXTRA_PHONE_ACCOUNT_HANDLE
to indicate the PhoneAccount
to configure. If the
PhoneAccount
package does not register an Activity
for this
intent, then it will not be sent.
Constant Value: "android.telecom.action.CONFIGURE_PHONE_ACCOUNT"
public static final String ACTION_DEFAULT_CALL_SCREENING_APP_CHANGED
Broadcast intent action indicating that the current default call screening app has changed.
Note: This intent is NEVER actually broadcast and will be deprecated in the future.
An app that want to know if it holds the
RoleManager.ROLE_CALL_SCREENING
role can use
RoleManager.isRoleHeld(String)
to confirm if it holds the role or
not.
Constant Value: "android.telecom.action.DEFAULT_CALL_SCREENING_APP_CHANGED"
public static final String ACTION_DEFAULT_DIALER_CHANGED
Broadcast intent action indicating that the current default dialer has changed.
The string extra EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
will contain the
name of the package that the default dialer was changed to.
See also:
Constant Value: "android.telecom.action.DEFAULT_DIALER_CHANGED"
public static final String ACTION_INCOMING_CALL
This constant is deprecated.
Use addNewIncomingCall(PhoneAccountHandle, Bundle)
instead.
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 ConnectionService
). Telecom reads the Intent extras to find
and bind to the appropriate ConnectionService
which Telecom will
ultimately use to control and get information about the call.
Input: get*Extra field EXTRA_PHONE_ACCOUNT_HANDLE
contains the component name of the
ConnectionService
that Telecom should bind to. Telecom will then
ask the connection service for more information about the call prior to showing any UI.
Constant Value: "android.telecom.action.INCOMING_CALL"
public static final String ACTION_PHONE_ACCOUNT_REGISTERED
Intent
action used indicate that a new phone account was just
registered.
The Intent Intent#getExtras()
will contain EXTRA_PHONE_ACCOUNT_HANDLE
to indicate which PhoneAccount
was registered.
Will only be sent to the default dialer app (see getDefaultDialerPackage()
).
Constant Value: "android.telecom.action.PHONE_ACCOUNT_REGISTERED"
public static final String ACTION_PHONE_ACCOUNT_UNREGISTERED
Intent
action used indicate that a phone account was just
unregistered.
The Intent Intent#getExtras()
will contain EXTRA_PHONE_ACCOUNT_HANDLE
to indicate which PhoneAccount
was unregistered.
Will only be sent to the default dialer app (see getDefaultDialerPackage()
).
Constant Value: "android.telecom.action.PHONE_ACCOUNT_UNREGISTERED"
public static final String ACTION_POST_CALL
Start an activity indicating that the completion of an outgoing call or an incoming call
which was not blocked by the CallScreeningService
, and which was NOT terminated
while the call was in Call#STATE_AUDIO_PROCESSING
.
The Uri
extra EXTRA_HANDLE
will contain the uri handle(phone number) for the
call which completed.
The integer extra EXTRA_DISCONNECT_CAUSE
will indicate the reason for the call
disconnection. See EXTRA_DISCONNECT_CAUSE
for more information.
The integer extra EXTRA_CALL_DURATION
will indicate the duration of the call. See
EXTRA_CALL_DURATION
for more information.
Constant Value: "android.telecom.action.POST_CALL"
public static final String ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS
The Intent
action used to show the call accessibility settings page.
Constant Value: "android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS"
public static final String ACTION_SHOW_CALL_SETTINGS
The Intent
action used to show the call settings page.
Constant Value: "android.telecom.action.SHOW_CALL_SETTINGS"
public static final String ACTION_SHOW_MISSED_CALLS_NOTIFICATION
Broadcast intent action for letting custom component know to show the missed call notification. If no custom component exists then this is sent to the default dialer which should post a missed-call notification.
Constant Value: "android.telecom.action.SHOW_MISSED_CALLS_NOTIFICATION"
public static final String ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS
The Intent
action used to show the respond via SMS settings page.
Constant Value: "android.telecom.action.SHOW_RESPOND_VIA_SMS_SETTINGS"
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.
Constant Value: 44 (0x0000002c)
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.
Constant Value: 59 (0x0000003b)
public static final int DURATION_LONG
A integer value for EXTRA_CALL_DURATION
, indicates the duration of the completed
call was >= 120 seconds.
Constant Value: 3 (0x00000003)
public static final int DURATION_MEDIUM
A integer value for EXTRA_CALL_DURATION
, indicates the duration of the completed
call was >= 60 seconds and < 120 seconds.
Constant Value: 2 (0x00000002)
public static final int DURATION_SHORT
A integer value for EXTRA_CALL_DURATION
, indicates the duration of the completed
call was >= 3 seconds and < 60 seconds.
Constant Value: 1 (0x00000001)
public static final int DURATION_VERY_SHORT
A integer value for EXTRA_CALL_DURATION
, indicates the duration of the completed
call was < 3 seconds.
Constant Value: 0 (0x00000000)
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).
ConnectionService
s which interact with RemoteConnection
s should only populate
this if the TelephonyManager.getLine1Number()
value, as that is the
user's expected caller ID.
Constant Value: "android.telecom.extra.CALL_BACK_NUMBER"
public static final String EXTRA_CALL_DISCONNECT_CAUSE
Optional extra for TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the disconnect code.
Constant Value: "android.telecom.extra.CALL_DISCONNECT_CAUSE"
public static final String EXTRA_CALL_DISCONNECT_MESSAGE
Optional extra for TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the disconnect message.
Constant Value: "android.telecom.extra.CALL_DISCONNECT_MESSAGE"
public static final String EXTRA_CALL_DURATION
A integer value provided for completed calls to indicate the duration of the call.
Allowed values:
Constant Value: "android.telecom.extra.CALL_DURATION"
public static final String EXTRA_CALL_NETWORK_TYPE
Optional extra for communicating the call network technology used by a
Connection
to Telecom and InCallUI.
NETWORK_TYPE_*
in TelephonyManager
.
Constant Value: "android.telecom.extra.CALL_NETWORK_TYPE"
public static final String EXTRA_CALL_SUBJECT
Optional extra for Intent.ACTION_CALL
containing a string call
subject which will be associated with an outgoing call. Should only be specified if the
PhoneAccount
supports the capability PhoneAccount#CAPABILITY_CALL_SUBJECT
.
Constant Value: "android.telecom.extra.CALL_SUBJECT"
public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
Extra value used to provide the package name for ACTION_CHANGE_DEFAULT_DIALER
.
Constant Value: "android.telecom.extra.CHANGE_DEFAULT_DIALER_PACKAGE_NAME"
public static final String EXTRA_DEFAULT_CALL_SCREENING_APP_COMPONENT_NAME
Extra value used with ACTION_DEFAULT_CALL_SCREENING_APP_CHANGED
broadcast to
indicate the ComponentName of the call screening app which has changed.
Note: This extra is NOT used and will be deprecated in the future.
Constant Value: "android.telecom.extra.DEFAULT_CALL_SCREENING_APP_COMPONENT_NAME"
public static final String EXTRA_DISCONNECT_CAUSE
A integer value provided for completed calls to indicate the reason for the call disconnection.
Allowed values:
DisconnectCause#UNKNOWN
DisconnectCause#LOCAL
DisconnectCause#REMOTE
DisconnectCause#REJECTED
DisconnectCause#MISSED
Constant Value: "android.telecom.extra.DISCONNECT_CAUSE"
public static final String EXTRA_HANDLE
A Uri
extra, which when set on the ACTION_POST_CALL
intent, indicates the
uri handle(phone number) of the completed call.
Constant Value: "android.telecom.extra.HANDLE"
public static final String EXTRA_INCOMING_CALL_ADDRESS
The extra used by a ConnectionService
to provide the handle of the caller that
has initiated a new incoming call.
Constant Value: "android.telecom.extra.INCOMING_CALL_ADDRESS"
public static final String EXTRA_INCOMING_CALL_EXTRAS
Optional extra for ACTION_INCOMING_CALL
containing a Bundle
which contains
metadata about the call. This Bundle
will be returned to the
ConnectionService
.
Constant Value: "android.telecom.extra.INCOMING_CALL_EXTRAS"
public static final String EXTRA_INCOMING_VIDEO_STATE
Optional extra for addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
containing an
integer that determines the requested video state for an incoming call.
Valid options:
VideoProfile#STATE_AUDIO_ONLY
,
VideoProfile#STATE_BIDIRECTIONAL
,
VideoProfile#STATE_RX_ENABLED
,
VideoProfile#STATE_TX_ENABLED
.
Constant Value: "android.telecom.extra.INCOMING_VIDEO_STATE"
public static final String EXTRA_IS_DEFAULT_CALL_SCREENING_APP
Extra value used with ACTION_DEFAULT_CALL_SCREENING_APP_CHANGED
broadcast to
indicate whether an app is the default call screening app.
Note: This extra is NOT used and will be deprecated in the future.
Constant Value: "android.telecom.extra.IS_DEFAULT_CALL_SCREENING_APP"
public static final String EXTRA_NOTIFICATION_COUNT
The number of calls associated with the notification. If the number is zero then the missed call notification should be dismissed.
Constant Value: "android.telecom.extra.NOTIFICATION_COUNT"
public static final String EXTRA_NOTIFICATION_PHONE_NUMBER
The number associated with the missed calls. This number is only relevant when EXTRA_NOTIFICATION_COUNT is 1.
Constant Value: "android.telecom.extra.NOTIFICATION_PHONE_NUMBER"
public static final String EXTRA_OUTGOING_CALL_EXTRAS
Optional extra for Intent.ACTION_CALL
and
Intent.ACTION_DIAL
Intent
containing a Bundle
which contains metadata about the call. This Bundle
will be saved into
Call.Details
and passed to the ConnectionService
when placing the call.
Constant Value: "android.telecom.extra.OUTGOING_CALL_EXTRAS"
public static final String EXTRA_PHONE_ACCOUNT_HANDLE
The extra used with an Intent.ACTION_CALL
and
Intent.ACTION_DIAL
Intent
to specify a
PhoneAccountHandle
to use when making the call.
Retrieve with Intent.getParcelableExtra(String)
.
Constant Value: "android.telecom.extra.PHONE_ACCOUNT_HANDLE"
public static final String EXTRA_START_CALL_WITH_RTT
A boolean extra, which when set on the Intent#ACTION_CALL
intent or on the bundle
passed into placeCall(android.net.Uri, android.os.Bundle)
, indicates that the call should be initiated with
an RTT session open. See Call.RttCall
for more information on RTT.
Constant Value: "android.telecom.extra.START_CALL_WITH_RTT"
public static final String EXTRA_START_CALL_WITH_SPEAKERPHONE
Optional extra for Intent.ACTION_CALL
containing a boolean that
determines whether the speakerphone should be automatically turned on for an outgoing call.
Constant Value: "android.telecom.extra.START_CALL_WITH_SPEAKERPHONE"
public static final String EXTRA_START_CALL_WITH_VIDEO_STATE
Optional extra for Intent.ACTION_CALL
containing an integer that
determines the desired video state for an outgoing call.
Valid options:
VideoProfile#STATE_AUDIO_ONLY
,
VideoProfile#STATE_BIDIRECTIONAL
,
VideoProfile#STATE_RX_ENABLED
,
VideoProfile#STATE_TX_ENABLED
.
Constant Value: "android.telecom.extra.START_CALL_WITH_VIDEO_STATE"
public static final String EXTRA_USE_ASSISTED_DIALING
The boolean indicated by this extra controls whether or not a call is eligible to undergo
assisted dialing. This extra is stored under EXTRA_OUTGOING_CALL_EXTRAS
.
The call initiator can use this extra to indicate that a call used assisted dialing to help place the call. This is most commonly used by a Dialer app which provides the ability to automatically add dialing prefixes when placing international calls.
Setting this extra on the outgoing call extras will cause the
Connection#PROPERTY_ASSISTED_DIALING
property and
Call.Details#PROPERTY_ASSISTED_DIALING
property to be set on the
Connection
/Call
in question. When the call is logged to the call log, the
CallLog.Calls.FEATURES_ASSISTED_DIALING_USED
call feature is set to
indicate that assisted dialing was used for the call.
Constant Value: "android.telecom.extra.USE_ASSISTED_DIALING"
public static final String GATEWAY_ORIGINAL_ADDRESS
An optional 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 Uri
.
(See GATEWAY_PROVIDER_PACKAGE
for details)
Constant Value: "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS"
public static final String GATEWAY_PROVIDER_PACKAGE
An optional 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 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.
Constant Value: "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE"
public static final String METADATA_INCLUDE_EXTERNAL_CALLS
A boolean meta-data value indicating whether an InCallService
wants to be informed of
calls which have the Call.Details#PROPERTY_IS_EXTERNAL_CALL
property. An external
call is one which a ConnectionService
knows about, but is not connected to directly.
Dialer implementations (see getDefaultDialerPackage()
) which would like to be
informed of external calls should set this meta-data to true
in the manifest
registration of their InCallService
. By default, the InCallService
will NOT
be informed of external calls.
Constant Value: "android.telecom.INCLUDE_EXTERNAL_CALLS"
public static final String METADATA_INCLUDE_SELF_MANAGED_CALLS
A boolean meta-data value indicating whether an InCallService
wants to be informed of
calls which have the Call.Details#PROPERTY_SELF_MANAGED
property. A self-managed
call is one which originates from a self-managed ConnectionService
which has chosen
to implement its own call user interface. An InCallService
implementation which
would like to be informed of external calls should set this meta-data to true
in the
manifest registration of their InCallService
. By default, the InCallService
will NOT be informed about self-managed calls.
An InCallService
which receives self-managed calls is free to view and control the
state of calls in the self-managed ConnectionService
. An example use-case is
exposing these calls to an automotive device via its companion app.
This meta-data can only be set for an InCallService
which also sets
METADATA_IN_CALL_SERVICE_UI
. Only the default phone/dialer app, or a car-mode
InCallService
can see self-managed calls.
See also Connection#PROPERTY_SELF_MANAGED
.
Constant Value: "android.telecom.INCLUDE_SELF_MANAGED_CALLS"
public static final String METADATA_IN_CALL_SERVICE_CAR_MODE_UI
A boolean meta-data value indicating whether an InCallService
implements an
in-call user interface to be used while the device is in car-mode (see
Configuration.UI_MODE_TYPE_CAR
).
Constant Value: "android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"
public static final String METADATA_IN_CALL_SERVICE_RINGING
A boolean meta-data value indicating whether an InCallService
implements ringing.
Dialer implementations (see getDefaultDialerPackage()
) which would also like to
override the system provided ringing should set this meta-data to true
in the
manifest registration of their InCallService
.
When true
, it is the InCallService
's responsibility to play a ringtone for
all incoming calls.
Constant Value: "android.telecom.IN_CALL_SERVICE_RINGING"
public static final String METADATA_IN_CALL_SERVICE_UI
A boolean meta-data value indicating whether an InCallService
implements an
in-call user interface. Dialer implementations (see getDefaultDialerPackage()
) which
would also like to replace the in-call interface should set this meta-data to true
in
the manifest registration of their InCallService
.
Constant Value: "android.telecom.IN_CALL_SERVICE_UI"
public static final int PRESENTATION_ALLOWED
Indicates that the address or number of a call is allowed to be displayed for caller ID.
Constant Value: 1 (0x00000001)
public static final int PRESENTATION_PAYPHONE
Indicates that the address or number of a call belongs to a pay phone.
Constant Value: 4 (0x00000004)
public static final int PRESENTATION_RESTRICTED
Indicates that the address or number of a call is blocked by the other party.
Constant Value: 2 (0x00000002)
public static final int PRESENTATION_UNKNOWN
Indicates that the address or number of a call is not specified or known by the carrier.
Constant Value: 3 (0x00000003)
public void acceptHandover (Uri srcAddr, int videoState, PhoneAccountHandle destAcct)
Called by an app to indicate that it wishes to accept the handover of an ongoing call to a
PhoneAccountHandle
it defines.
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 initiating device is where a user initiated
the handover process (e.g. by calling Call.handoverTo(PhoneAccountHandle, int, Bundle)
, and the other device is considered the receiving
device.
For a full discussion of the handover process and the APIs involved, see
Call.handoverTo(PhoneAccountHandle, int, Bundle)
.
This method is called from the receiving side of a handover to indicate a desire to
accept the handover of an ongoing call to another ConnectionService
identified by
PhoneAccountHandle
destAcct. For managed ConnectionService
s, the specified
PhoneAccountHandle
must have been registered with registerPhoneAccount(PhoneAccount)
and
the user must have enabled the corresponding PhoneAccount
. This can be checked using
getPhoneAccount(PhoneAccountHandle)
. Self-managed ConnectionService
s must have
Manifest.permission.MANAGE_OWN_CALLS
to handover a call to it.
Once invoked, this method will cause the system to bind to the ConnectionService
associated with the PhoneAccountHandle
destAcct and call
(See ConnectionService#onCreateIncomingHandoverConnection
).
For a managed ConnectionService
, a SecurityException
will be thrown if either
the PhoneAccountHandle
destAcct does not correspond to a registered
PhoneAccount
or the associated PhoneAccount
is not currently enabled by the
user.
For a self-managed ConnectionService
, a SecurityException
will be thrown if
the calling app does not have Manifest.permission.MANAGE_OWN_CALLS
.
Parameters | |
---|---|
srcAddr |
Uri : The Uri of the ongoing call to handover to the caller’s
ConnectionService . |
videoState |
int : Video state after the handover.
Value is either 0 or a combination of VideoProfile.STATE_AUDIO_ONLY , VideoProfile.STATE_TX_ENABLED , VideoProfile.STATE_RX_ENABLED , VideoProfile.STATE_BIDIRECTIONAL , and VideoProfile.STATE_PAUSED |
destAcct |
PhoneAccountHandle : The PhoneAccountHandle registered to the calling package. |
public void acceptRingingCall (int videoState)
This method is deprecated.
Companion apps for wearable devices should use the InCallService
API
instead.
If there is a ringing incoming call, this method accepts the call on behalf of the user,
with the specified video state.
Requires permission: Manifest.permission.MODIFY_PHONE_STATE
or
Manifest.permission.ANSWER_PHONE_CALLS
Requires Manifest.permission.ANSWER_PHONE_CALLS
or Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
videoState |
int : The desired video state to answer the call with. |
public void acceptRingingCall ()
This method is deprecated.
Companion apps for wearable devices should use the InCallService
API
instead.
If there is a ringing incoming call, this method accepts the call on behalf of the user.
If the incoming call is a video call, the call will be answered with the same video state as
the incoming call requests. This means, for example, that an incoming call requesting
VideoProfile#STATE_BIDIRECTIONAL
will be answered, accepting that state.
Requires permission: Manifest.permission.MODIFY_PHONE_STATE
or
Manifest.permission.ANSWER_PHONE_CALLS
Requires Manifest.permission.ANSWER_PHONE_CALLS
or Manifest.permission.MODIFY_PHONE_STATE
public void addNewIncomingCall (PhoneAccountHandle phoneAccount, Bundle extras)
Registers a new incoming call. A ConnectionService
should invoke this method when it
has an incoming call. For managed ConnectionService
s, the specified
PhoneAccountHandle
must have been registered with registerPhoneAccount(PhoneAccount)
and
the user must have enabled the corresponding PhoneAccount
. This can be checked using
getPhoneAccount(PhoneAccountHandle)
. Self-managed ConnectionService
s must have
Manifest.permission.MANAGE_OWN_CALLS
to add a new incoming call.
The incoming call you are adding is assumed to have a video state of
VideoProfile#STATE_AUDIO_ONLY
, unless the extra value
EXTRA_INCOMING_VIDEO_STATE
is specified.
Once invoked, this method will cause the system to bind to the ConnectionService
associated with the PhoneAccountHandle
and request additional information about the
call (See ConnectionService#onCreateIncomingConnection
) before starting the incoming
call UI.
For a managed ConnectionService
, a SecurityException
will be thrown if either
the PhoneAccountHandle
does not correspond to a registered PhoneAccount
or
the associated PhoneAccount
is not currently enabled by the user.
For a self-managed ConnectionService
, a SecurityException
will be thrown if
the PhoneAccount
has PhoneAccount#CAPABILITY_SELF_MANAGED
and the calling app
does not have Manifest.permission.MANAGE_OWN_CALLS
.
Parameters | |
---|---|
phoneAccount |
PhoneAccountHandle : A PhoneAccountHandle registered with
registerPhoneAccount(PhoneAccount) . |
extras |
Bundle : A bundle that will be passed through to
ConnectionService#onCreateIncomingConnection . |
public void cancelMissedCallsNotification ()
Removes the missed-call notification if one is present.
Requires that the method-caller be set as the system dialer app.
Requires permission:Manifest.permission.MODIFY_PHONE_STATE
Manifest.permission.MODIFY_PHONE_STATE
public Intent createManageBlockedNumbersIntent ()
Creates the Intent
which can be used with Context#startActivity(Intent)
to
launch the activity to manage blocked numbers.
The activity will display the UI to manage blocked numbers only if
BlockedNumberContract.canCurrentUserBlockNumbers(Context)
returns
true
for the current user.
Returns | |
---|---|
Intent |
public boolean endCall ()
This method is deprecated.
Companion apps for wearable devices should use the InCallService
API
instead. Apps performing call screening should use the CallScreeningService
API
instead.
Ends the foreground call on the device.
If there is a ringing call, calling this method rejects the ringing call. Otherwise the foreground call is ended.
Requires permission Manifest.permission.ANSWER_PHONE_CALLS
.
Note: this method CANNOT be used to end ongoing emergency calls and will return false
if an attempt is made to end an emergency call.
Requires Manifest.permission.ANSWER_PHONE_CALLS
Returns | |
---|---|
boolean |
true if there is a call which will be rejected or terminated, false
otherwise. |
public Uri getAdnUriForPhoneAccount (PhoneAccountHandle accountHandle)
Requires permission: Manifest.permission.MODIFY_PHONE_STATE
Requires Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : The handle for the account to derive an adn query URI for or
null to return a URI which will use the default account. |
Returns | |
---|---|
Uri |
The URI (with the content:// scheme) specific to the specified PhoneAccount
for the the content retrieve. |
public List<PhoneAccountHandle> getCallCapablePhoneAccounts ()
Returns a list of PhoneAccountHandle
s which can be used to make and receive phone
calls. The returned list includes only those accounts which have been explicitly enabled
by the user.
Requires permission: Manifest.permission.READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
List<PhoneAccountHandle> |
A list of PhoneAccountHandle objects. |
See also:
public String getDefaultDialerPackage ()
Used to determine the currently selected default dialer package.
Returns | |
---|---|
String |
package name for the default dialer package or null if no package has been selected as the default dialer. |
public PhoneAccountHandle getDefaultOutgoingPhoneAccount (String uriScheme)
Return the PhoneAccount
which will be used to place outgoing calls to addresses with
the specified uriScheme
. This PhoneAccount
will always be a member of the
list which is returned from invoking getCallCapablePhoneAccounts()
. The specific
account returned depends on the following priorities:
PhoneAccount
supports the specified scheme, it will
be returned.
PhoneAccount
that supports the specified scheme, it
will be returned.
If no PhoneAccount
fits the criteria above, this method will return null
.
Requires permission: Manifest.permission.READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Parameters | |
---|---|
uriScheme |
String : The URI scheme. |
Returns | |
---|---|
PhoneAccountHandle |
The PhoneAccountHandle corresponding to the account to be used. |
public String getLine1Number (PhoneAccountHandle accountHandle)
Return the line 1 phone number for given phone account.
Requires Permission:
READ_SMS
,
READ_PHONE_NUMBERS
,
or that the caller is the default SMS app for any API level.
READ_PHONE_STATE
for apps targeting SDK API level 29 and below.
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : The handle for the account retrieve a number for. |
Returns | |
---|---|
String |
A string representation of the line 1 phone number. |
public PhoneAccount getPhoneAccount (PhoneAccountHandle account)
Return the PhoneAccount
for a specified PhoneAccountHandle
. Object includes
resources which can be used in a user interface.
Parameters | |
---|---|
account |
PhoneAccountHandle : The PhoneAccountHandle . |
Returns | |
---|---|
PhoneAccount |
The PhoneAccount object. |
public List<PhoneAccountHandle> getSelfManagedPhoneAccounts ()
Returns a list of PhoneAccountHandle
s for self-managed ConnectionService
s.
Self-Managed ConnectionService
s have a PhoneAccount
with
PhoneAccount#CAPABILITY_SELF_MANAGED
.
Requires permission Manifest.permission.READ_PHONE_STATE
, or that the caller
is the default dialer app.
A SecurityException
will be thrown if a called is not the default dialer, or lacks
the Manifest.permission.READ_PHONE_STATE
permission.
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
List<PhoneAccountHandle> |
A list of PhoneAccountHandle objects. |
public PhoneAccountHandle getSimCallManager ()
Returns the current SIM call manager. Apps must be prepared for this method to return
null
, indicating that there currently exists no SIM call manager PhoneAccount
for the default voice subscription.
Returns | |
---|---|
PhoneAccountHandle |
The phone account handle of the current sim call manager for the default voice subscription. |
public PhoneAccountHandle getSimCallManagerForSubscription (int subscriptionId)
Returns current SIM call manager for the Telephony Subscription ID specified. Apps must be
prepared for this method to return null
, indicating that there currently exists no
SIM call manager PhoneAccount
for the subscription specified.
Parameters | |
---|---|
subscriptionId |
int : The Telephony Subscription ID that the SIM call manager should be
queried for. |
Returns | |
---|---|
PhoneAccountHandle |
The phone account handle of the current sim call manager. |
public String getSystemDialerPackage ()
Determines the package name of the system-provided default phone app.
Returns | |
---|---|
String |
package name for the system dialer package or null if no system dialer is
preloaded. |
public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount ()
Return the PhoneAccount
which is the user-chosen default for making outgoing phone
calls. This PhoneAccount
will always be a member of the list which is returned from
calling getCallCapablePhoneAccounts()
Apps must be prepared for this method to return null
, indicating that there currently
exists no user-chosen default PhoneAccount
.
The default dialer has access to use this method.
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
PhoneAccountHandle |
The user outgoing phone account selected by the user, or null if there is no
user selected outgoing PhoneAccountHandle . |
public String getVoiceMailNumber (PhoneAccountHandle accountHandle)
Return the voicemail number for a given phone account.
Requires permission: Manifest.permission.READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : The handle for the phone account. |
Returns | |
---|---|
String |
The voicemail number for the phone account, and null if one has not been
configured. |
public boolean handleMmi (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.
Requires permission:Manifest.permission.MODIFY_PHONE_STATE
Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
dialString |
String : The digits to dial. |
Returns | |
---|---|
boolean |
True if the digits were processed as an MMI code, false otherwise. |
public boolean handleMmi (String dialString, PhoneAccountHandle accountHandle)
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.
Requires permission:Manifest.permission.MODIFY_PHONE_STATE
Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
dialString |
String : The digits to dial. |
accountHandle |
PhoneAccountHandle : The handle for the account the MMI code should apply to. |
Returns | |
---|---|
boolean |
True if the digits were processed as an MMI code, false otherwise. |
public boolean isInCall ()
Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding
states) originating from either a manager or self-managed ConnectionService
.
Requires permission: Manifest.permission.READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
boolean |
true if there is an ongoing call in either a managed or self-managed
ConnectionService , false otherwise. |
public boolean isInManagedCall ()
Returns whether there is an ongoing call originating from a managed
ConnectionService
. An ongoing call can be in dialing, ringing, active or holding
states.
If you also need to know if there are ongoing self-managed calls, use isInCall()
instead.
Requires permission: Manifest.permission.READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
boolean |
true if there is an ongoing call in a managed ConnectionService ,
false otherwise. |
public boolean isIncomingCallPermitted (PhoneAccountHandle phoneAccountHandle)
Determines whether Telecom would permit an incoming call to be added via the
addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
API for the specified
PhoneAccountHandle
.
A ConnectionService
may not add a call for the specified PhoneAccountHandle
in the following situations:
PhoneAccount
does not have property
PhoneAccount#CAPABILITY_SELF_MANAGED
set (i.e. it is a managed
ConnectionService
), and the active or held call limit has
been reached.Parameters | |
---|---|
phoneAccountHandle |
PhoneAccountHandle : The PhoneAccountHandle the call will be added for. |
Returns | |
---|---|
boolean |
true if telecom will permit an incoming call to be added, false
otherwise. |
public boolean isOutgoingCallPermitted (PhoneAccountHandle phoneAccountHandle)
Determines whether Telecom would permit an outgoing call to be placed via the
placeCall(android.net.Uri, android.os.Bundle)
API for the specified PhoneAccountHandle
.
A ConnectionService
may not place a call for the specified PhoneAccountHandle
in the following situations:
PhoneAccount
does not have property
PhoneAccount#CAPABILITY_SELF_MANAGED
set (i.e. it is a managed
ConnectionService
), and the active, held or ringing call limit has
been reached.PhoneAccount
has property PhoneAccount#CAPABILITY_SELF_MANAGED
set
(i.e. it is a self-managed ConnectionService
and there is an ongoing call in
another ConnectionService
.Parameters | |
---|---|
phoneAccountHandle |
PhoneAccountHandle : The PhoneAccountHandle the call will be added for. |
Returns | |
---|---|
boolean |
true if telecom will permit an outgoing call to be placed, false
otherwise. |
public boolean isTtySupported ()
Returns whether TTY is supported on this device.
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE or Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
boolean |
public boolean isVoiceMailNumber (PhoneAccountHandle accountHandle, String number)
Return whether a given phone number is the configured voicemail number for a
particular phone account.
Requires permission: Manifest.permission.READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : The handle for the account to check the voicemail number against |
number |
String : The number to look up. |
Returns | |
---|---|
boolean |
public void placeCall (Uri address, Bundle extras)
Places a new outgoing call to the provided address using the system telecom service with
the specified extras.
This method is equivalent to placing an outgoing call using Intent#ACTION_CALL
,
except that the outgoing call will always be sent via the system telecom service. If
method-caller is either the user selected default dialer app or preloaded system dialer
app, then emergency calls will also be allowed.
Placing a call via a managed ConnectionService
requires permission:
Manifest.permission.CALL_PHONE
Usage example:
Uri uri = Uri.fromParts("tel", "12345", null); Bundle extras = new Bundle(); extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, true); telecomManager.placeCall(uri, extras);The following keys are supported in the supplied extras.
EXTRA_OUTGOING_CALL_EXTRAS
EXTRA_PHONE_ACCOUNT_HANDLE
EXTRA_START_CALL_WITH_SPEAKERPHONE
EXTRA_START_CALL_WITH_VIDEO_STATE
An app which implements the self-managed ConnectionService
API uses
placeCall(android.net.Uri, android.os.Bundle)
to inform Telecom of a new outgoing call. A self-managed
ConnectionService
must include EXTRA_PHONE_ACCOUNT_HANDLE
to specify its
associated PhoneAccountHandle
.
Self-managed ConnectionService
s require permission
Manifest.permission.MANAGE_OWN_CALLS
.
Note: If this method is used to place an emergency call, it
is not guaranteed that the call will be placed on the PhoneAccount
provided in
the EXTRA_PHONE_ACCOUNT_HANDLE
extra (if specified) and may be placed on another
PhoneAccount
with the PhoneAccount#CAPABILITY_PLACE_EMERGENCY_CALLS
capability, depending on external factors, such as network conditions and Modem/SIM status.
Manifest.permission.CALL_PHONE
or Manifest.permission.MANAGE_OWN_CALLS
Parameters | |
---|---|
address |
Uri : The address to make the call to. |
extras |
Bundle : Bundle of extras to use with the call. |
public void registerPhoneAccount (PhoneAccount account)
Register a PhoneAccount
for use by the system that will be stored in Device Encrypted
storage. When registering PhoneAccount
s, existing registrations will be overwritten
if the PhoneAccountHandle
matches that of a PhoneAccount
which is already
registered. Once registered, the PhoneAccount
is listed to the user as an option
when placing calls. The user may still need to enable the PhoneAccount
within
the phone app settings before the account is usable.
A SecurityException
will be thrown if an app tries to register a
PhoneAccountHandle
where the package name specified within
PhoneAccountHandle#getComponentName()
does not match the package name of the app.
Parameters | |
---|---|
account |
PhoneAccount : The complete PhoneAccount . |
public void showInCallScreen (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
Manifest.permission.READ_PHONE_STATE
permission.
Manifest.permission.READ_PHONE_STATE
Parameters | |
---|---|
showDialpad |
boolean : Brings up the in-call dialpad as part of showing the in-call screen. |
public void silenceRinger ()
Silences the ringer if a ringing call exists.
This method can only be relied upon to stop the ringtone for a call if the ringtone has already started playing. It is intended to handle use-cases such as silencing a ringing call when the user presses the volume button during ringing.
If this method is called prior to when the ringtone begins playing, the ringtone will not be silenced. As such it is not intended as a means to avoid playing of a ringtone.
A dialer app which wants to have more control over ringtone playing should declare
TelecomManager#METADATA_IN_CALL_SERVICE_RINGING
in the manifest entry for their
InCallService
implementation to indicate that the app wants to be responsible for
playing the ringtone for all incoming calls.
Requires permission: Manifest.permission.MODIFY_PHONE_STATE
or that the
app fills the dialer role (see getDefaultDialerPackage()
).
Requires Manifest.permission.MODIFY_PHONE_STATE
public void unregisterPhoneAccount (PhoneAccountHandle accountHandle)
Remove a PhoneAccount
registration from the system.
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : A PhoneAccountHandle for the PhoneAccount to unregister. |