public class TelecomManager extends Object
Apps do not instantiate this class directly; instead, they retrieve a reference to an instance
through 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.
Modifier and Type | Field and Description |
---|---|
static 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 . |
static String |
ACTION_CHANGE_PHONE_ACCOUNTS
The
Intent action used to show the settings page used to configure
PhoneAccount preferences. |
static String |
ACTION_CONFIGURE_PHONE_ACCOUNT
An
Intent action sent by the telecom framework to start a
configuration dialog for a registered PhoneAccount . |
static String |
ACTION_CURRENT_TTY_MODE_CHANGED
Broadcast intent action indicating that the current TTY mode has changed.
|
static String |
ACTION_DEFAULT_DIALER_CHANGED
Broadcast intent action indicating that the current default dialer has changed.
|
static String |
ACTION_INCOMING_CALL
Activity action: Starts the UI for handing an incoming call.
|
static String |
ACTION_NEW_UNKNOWN_CALL
Similar to
ACTION_INCOMING_CALL , but is used only by Telephony to add a new
sim-initiated MO call for carrier testing. |
static String |
ACTION_PHONE_ACCOUNT_REGISTERED
The
Intent action used indicate that a new phone account was
just registered. |
static String |
ACTION_PHONE_ACCOUNT_UNREGISTERED
The
Intent action used indicate that a phone account was
just unregistered. |
static String |
ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS
The
Intent action used to show the call accessibility settings page. |
static String |
ACTION_SHOW_CALL_SETTINGS
The
Intent action used to show the call settings page. |
static String |
ACTION_SHOW_MISSED_CALLS_NOTIFICATION
Broadcast intent action for letting custom component know to show the missed call
notification.
|
static String |
ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS
The
Intent action used to show the respond via SMS settings page. |
static String |
ACTION_TTY_PREFERRED_MODE_CHANGED
Broadcast intent action indicating that the TTY preferred operating mode has changed.
|
static char |
DTMF_CHARACTER_PAUSE
The dual tone multi-frequency signaling character sent to indicate the dialing system should
pause for a predefined period.
|
static char |
DTMF_CHARACTER_WAIT
The dual-tone multi-frequency signaling character sent to indicate the dialing system should
wait for user confirmation before proceeding.
|
static String |
EXTRA_CALL_BACK_INTENT
The intent to call back a missed call.
|
static 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).
|
static String |
EXTRA_CALL_CREATED_TIME_MILLIS
Optional extra for incoming and outgoing calls containing a long which specifies the time the
call was created.
|
static String |
EXTRA_CALL_DISCONNECT_CAUSE
Optional extra for
TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the disconnect code. |
static String |
EXTRA_CALL_DISCONNECT_MESSAGE
Optional extra for
TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the disconnect message. |
static String |
EXTRA_CALL_SUBJECT
Optional extra for
Intent.ACTION_CALL containing a string call
subject which will be associated with an outgoing call. |
static String |
EXTRA_CALL_TECHNOLOGY_TYPE
Optional extra for communicating the call technology used by a
Connection to Telecom |
static String |
EXTRA_CALL_TELECOM_ROUTING_END_TIME_MILLIS
Optional extra for incoming and outgoing calls containing a long which specifies the time
telecom finished routing the call.
|
static String |
EXTRA_CALL_TELECOM_ROUTING_START_TIME_MILLIS
Optional extra for incoming and outgoing calls containing a long which specifies the time
telecom began routing the call.
|
static String |
EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
Extra value used to provide the package name for
ACTION_CHANGE_DEFAULT_DIALER . |
static String |
EXTRA_CLEAR_MISSED_CALLS_INTENT
The intent to clear missed calls.
|
static String |
EXTRA_CONNECTION_SERVICE
Optional extra for
TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the component name of the associated connection service. |
static String |
EXTRA_CURRENT_TTY_MODE
The lookup key for an int that indicates the current TTY mode.
|
static 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. |
static String |
EXTRA_INCOMING_CALL_EXTRAS
Optional extra for
ACTION_INCOMING_CALL containing a Bundle which contains
metadata about the call. |
static String |
EXTRA_NOTIFICATION_COUNT
The number of calls associated with the notification.
|
static String |
EXTRA_NOTIFICATION_PHONE_NUMBER
The number associated with the missed calls.
|
static 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. |
static 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. |
static 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. |
static 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. |
static String |
EXTRA_TTY_PREFERRED_MODE
The lookup key for an int that indicates preferred TTY mode.
|
static String |
EXTRA_UNKNOWN_CALL_HANDLE |
static String |
GATEWAY_ORIGINAL_ADDRESS
An optional
Intent.ACTION_CALL intent extra corresponding to the
original address to dial for the call. |
static 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. |
static 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
android.content.res.Configuration.UI_MODE_TYPE_CAR ). |
static String |
METADATA_IN_CALL_SERVICE_RINGING
A boolean meta-data value indicating whether an
InCallService implements ringing. |
static String |
METADATA_IN_CALL_SERVICE_UI
A boolean meta-data value indicating whether an
InCallService implements an
in-call user interface. |
static 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. |
static int |
PRESENTATION_ALLOWED
Indicates that the address or number of a call is allowed to be displayed for caller ID.
|
static int |
PRESENTATION_PAYPHONE
Indicates that the address or number of a call belongs to a pay phone.
|
static int |
PRESENTATION_RESTRICTED
Indicates that the address or number of a call is blocked by the other party.
|
static int |
PRESENTATION_UNKNOWN
Indicates that the address or number of a call is not specified or known by the carrier.
|
static int |
TTY_MODE_FULL
TTY (teletypewriter) mode is on.
|
static int |
TTY_MODE_HCO
TTY (teletypewriter) mode is in hearing carryover mode (HCO).
|
static int |
TTY_MODE_OFF
TTY (teletypewriter) mode is off.
|
static int |
TTY_MODE_VCO
TTY (teletypewriter) mode is in voice carryover mode (VCO).
|
Constructor and Description |
---|
TelecomManager(Context context) |
TelecomManager(Context context,
ITelecomService telecomServiceImpl) |
Modifier and Type | Method and Description |
---|---|
void |
acceptRingingCall()
If there is a ringing incoming call, this method accepts the call on behalf of the user.
|
void |
acceptRingingCall(int videoState)
If there is a ringing incoming call, this method accepts the call on behalf of the user,
with the specified video state.
|
void |
addNewIncomingCall(PhoneAccountHandle phoneAccount,
Bundle extras)
Registers a new incoming call.
|
void |
addNewUnknownCall(PhoneAccountHandle phoneAccount,
Bundle extras)
Registers a new unknown call with Telecom.
|
void |
cancelMissedCallsNotification()
Removes the missed-call notification if one is present.
|
void |
clearAccounts()
Deprecated.
Use
clearPhoneAccounts() instead. |
void |
clearAccountsForPackage(String packageName)
Remove all Accounts that belong to the specified package from the system.
|
void |
clearPhoneAccounts()
Remove all Accounts that belong to the calling package from the system.
|
Intent |
createManageBlockedNumbersIntent()
Creates the
Intent which can be used with Context.startActivity(Intent) to
launch the activity to manage blocked numbers. |
TelecomAnalytics |
dumpAnalytics()
Dumps telecom analytics for uploading.
|
void |
enablePhoneAccount(PhoneAccountHandle handle,
boolean isEnabled)
Enables and disables specified phone account.
|
boolean |
endCall()
Ends an ongoing call.
|
static TelecomManager |
from(Context context) |
Uri |
getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle)
Requires permission:
android.Manifest.permission#MODIFY_PHONE_STATE |
List<PhoneAccountHandle> |
getAllPhoneAccountHandles()
Returns a list of all
PhoneAccountHandle s. |
List<PhoneAccount> |
getAllPhoneAccounts()
Returns a list of all
PhoneAccount s. |
int |
getAllPhoneAccountsCount()
Returns a count of all
PhoneAccount s. |
List<PhoneAccountHandle> |
getCallCapablePhoneAccounts()
Returns a list of
PhoneAccountHandle s which can be used to make and receive phone
calls. |
List<PhoneAccountHandle> |
getCallCapablePhoneAccounts(boolean includeDisabledAccounts)
Returns a list of
PhoneAccountHandle s including those which have not been enabled
by the user. |
int |
getCallState()
Returns one of the following constants that represents the current state of Telecom:
TelephonyManager.CALL_STATE_RINGING
TelephonyManager.CALL_STATE_OFFHOOK
TelephonyManager.CALL_STATE_IDLE
Note that this API does not require the
android.Manifest.permission#READ_PHONE_STATE permission. |
PhoneAccountHandle |
getConnectionManager()
Returns the current connection manager.
|
int |
getCurrentTtyMode()
Returns the current TTY mode of the device.
|
String |
getDefaultDialerPackage()
Used to determine the currently selected default dialer package.
|
PhoneAccountHandle |
getDefaultOutgoingPhoneAccount(String uriScheme)
Return the
PhoneAccount which will be used to place outgoing calls to addresses with
the specified uriScheme . |
ComponentName |
getDefaultPhoneApp()
Deprecated.
- Use
getDefaultDialerPackage() to directly access
the default dialer's package name instead. |
String |
getLine1Number(PhoneAccountHandle accountHandle)
Return the line 1 phone number for given phone account.
|
PhoneAccount |
getPhoneAccount(PhoneAccountHandle account)
Return the
PhoneAccount for a specified PhoneAccountHandle . |
List<PhoneAccountHandle> |
getPhoneAccountsForPackage()
Returns a list of all
PhoneAccount s registered for the calling package. |
List<PhoneAccountHandle> |
getPhoneAccountsSupportingScheme(String uriScheme)
Returns a list of the
PhoneAccountHandle s which can be used to make and receive phone
calls which support the specified URI scheme. |
PhoneAccountHandle |
getSimCallManager()
Returns the current SIM call manager.
|
PhoneAccountHandle |
getSimCallManager(int userId)
Returns the current SIM call manager for the specified user.
|
String |
getSystemDialerPackage()
Used to determine the dialer package that is preloaded on the system partition.
|
PhoneAccountHandle |
getUserSelectedOutgoingPhoneAccount()
Return the
PhoneAccount which is the user-chosen default for making outgoing phone
calls. |
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).
|
boolean |
isRinging()
Returns whether there currently exists is a ringing incoming-call.
|
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
PhoneAccount for use by the system that will be stored in Device Encrypted
storage. |
boolean |
setDefaultDialer(String packageName)
Used to set the default dialer package.
|
void |
setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle)
Sets the user-chosen default for making outgoing phone calls.
|
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
PhoneAccount registration from the system. |
public static final String ACTION_INCOMING_CALL
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.
public static final String ACTION_NEW_UNKNOWN_CALL
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_CONFIGURE_PHONE_ACCOUNT
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.
public static final String ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS
Intent
action used to show the call accessibility settings page.public static final String ACTION_SHOW_CALL_SETTINGS
Intent
action used to show the call settings page.public static final String ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS
Intent
action used to show the respond via SMS settings page.public static final String ACTION_CHANGE_PHONE_ACCOUNTS
Intent
action used to show the settings page used to configure
PhoneAccount
preferences.public static final String ACTION_PHONE_ACCOUNT_REGISTERED
Intent
action used indicate that a new phone account was
just registered.public static final String ACTION_PHONE_ACCOUNT_UNREGISTERED
Intent
action used indicate that a phone account was
just unregistered.public static final String ACTION_CHANGE_DEFAULT_DIALER
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);
public static final String ACTION_DEFAULT_DIALER_CHANGED
EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
will contain the
name of the package that the default dialer was changed to.public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
ACTION_CHANGE_DEFAULT_DIALER
.public static final String EXTRA_START_CALL_WITH_SPEAKERPHONE
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
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
.public static final String EXTRA_PHONE_ACCOUNT_HANDLE
Intent.ACTION_CALL
and
Intent.ACTION_DIAL
Intent
to specify a
PhoneAccountHandle
to use when making the call.
Retrieve with Intent.getParcelableExtra(String)
.
public static final String EXTRA_CALL_SUBJECT
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
.public static final String EXTRA_INCOMING_CALL_ADDRESS
ConnectionService
to provide the handle of the caller that
has initiated a new incoming call.public static final String EXTRA_INCOMING_CALL_EXTRAS
ACTION_INCOMING_CALL
containing a Bundle
which contains
metadata about the call. This Bundle
will be returned to the
ConnectionService
.public static final String EXTRA_OUTGOING_CALL_EXTRAS
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.public static final String EXTRA_UNKNOWN_CALL_HANDLE
public static final String EXTRA_CALL_CREATED_TIME_MILLIS
public static final String EXTRA_CALL_TELECOM_ROUTING_START_TIME_MILLIS
public static final String EXTRA_CALL_TELECOM_ROUTING_END_TIME_MILLIS
public static final String EXTRA_CALL_DISCONNECT_CAUSE
TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the disconnect code.public static final String EXTRA_CALL_DISCONNECT_MESSAGE
TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the disconnect message.public static final String EXTRA_CONNECTION_SERVICE
TelephonyManager.ACTION_PHONE_STATE_CHANGED
containing the component name of the associated connection service.public static final String EXTRA_CALL_TECHNOLOGY_TYPE
Connection
to Telecompublic static final String GATEWAY_PROVIDER_PACKAGE
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.public static final String GATEWAY_ORIGINAL_ADDRESS
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)public static final String EXTRA_CALL_BACK_NUMBER
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.
public static final String METADATA_IN_CALL_SERVICE_UI
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
.public static final String METADATA_IN_CALL_SERVICE_CAR_MODE_UI
InCallService
implements an
in-call user interface to be used while the device is in car-mode (see
android.content.res.Configuration.UI_MODE_TYPE_CAR
).public static final String METADATA_IN_CALL_SERVICE_RINGING
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
.public static final String METADATA_INCLUDE_EXTERNAL_CALLS
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.public static final char DTMF_CHARACTER_PAUSE
public static final char DTMF_CHARACTER_WAIT
public static final int TTY_MODE_OFF
public static final int TTY_MODE_FULL
public static final int TTY_MODE_HCO
public static final int TTY_MODE_VCO
public static final String ACTION_CURRENT_TTY_MODE_CHANGED
EXTRA_CURRENT_TTY_MODE
,
Constant Field Valuespublic static final String EXTRA_CURRENT_TTY_MODE
TTY_MODE_OFF
- TTY_MODE_FULL
- TTY_MODE_HCO
- TTY_MODE_VCO
public static final String ACTION_TTY_PREFERRED_MODE_CHANGED
EXTRA_TTY_PREFERRED_MODE
,
Constant Field Valuespublic static final String EXTRA_TTY_PREFERRED_MODE
TTY_MODE_OFF
- TTY_MODE_FULL
- TTY_MODE_HCO
-
TTY_MODE_VCO
public static final String ACTION_SHOW_MISSED_CALLS_NOTIFICATION
public static final String EXTRA_NOTIFICATION_COUNT
public static final String EXTRA_NOTIFICATION_PHONE_NUMBER
public static final String EXTRA_CLEAR_MISSED_CALLS_INTENT
public static final String EXTRA_CALL_BACK_INTENT
public static final int PRESENTATION_ALLOWED
public static final int PRESENTATION_RESTRICTED
public static final int PRESENTATION_UNKNOWN
public static final int PRESENTATION_PAYPHONE
public TelecomManager(Context context)
public TelecomManager(Context context, ITelecomService telecomServiceImpl)
public static TelecomManager from(Context context)
public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme)
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: android.Manifest.permission#READ_PHONE_STATE
uriScheme
- The URI scheme.PhoneAccountHandle
corresponding to the account to be used.public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount()
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
.
public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle)
public PhoneAccountHandle getSimCallManager()
null
, indicating that there currently exists no user-chosen default
PhoneAccount
.public PhoneAccountHandle getSimCallManager(int userId)
null
, indicating that there currently exists no user-chosen default
PhoneAccount
.public PhoneAccountHandle getConnectionManager()
null
, indicating that there currently exists no user-chosen default
PhoneAccount
.public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme)
PhoneAccountHandle
s which can be used to make and receive phone
calls which support the specified URI scheme.
For example, invoking with "tel"
will find all PhoneAccountHandle
s which
support telephone calls (e.g. URIs such as tel:555-555-1212
). Invoking with
"sip"
will find all PhoneAccountHandle
s which support SIP calls (e.g. URIs
such as sip:example@sipexample.com
).
uriScheme
- The URI scheme.PhoneAccountHandle
objects supporting the URI scheme.public List<PhoneAccountHandle> getCallCapablePhoneAccounts()
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: android.Manifest.permission#READ_PHONE_STATE
PhoneAccountHandle
objects.EXTRA_PHONE_ACCOUNT_HANDLE
public List<PhoneAccountHandle> getCallCapablePhoneAccounts(boolean includeDisabledAccounts)
PhoneAccountHandle
s including those which have not been enabled
by the user.PhoneAccountHandle
objects.public List<PhoneAccountHandle> getPhoneAccountsForPackage()
PhoneAccount
s registered for the calling package.PhoneAccountHandle
objects.public PhoneAccount getPhoneAccount(PhoneAccountHandle account)
PhoneAccount
for a specified PhoneAccountHandle
. Object includes
resources which can be used in a user interface.account
- The PhoneAccountHandle
.PhoneAccount
object.public int getAllPhoneAccountsCount()
PhoneAccount
s.PhoneAccount
s.public List<PhoneAccount> getAllPhoneAccounts()
PhoneAccount
s.PhoneAccount
s.public List<PhoneAccountHandle> getAllPhoneAccountHandles()
PhoneAccountHandle
s.PhoneAccountHandle
s.public void registerPhoneAccount(PhoneAccount account)
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.
account
- The complete PhoneAccount
.public void unregisterPhoneAccount(PhoneAccountHandle accountHandle)
PhoneAccount
registration from the system.accountHandle
- A PhoneAccountHandle
for the PhoneAccount
to unregister.public void clearPhoneAccounts()
public void clearAccounts()
clearPhoneAccounts()
instead.public void clearAccountsForPackage(String packageName)
public ComponentName getDefaultPhoneApp()
getDefaultDialerPackage()
to directly access
the default dialer's package name instead.public String getDefaultDialerPackage()
public boolean setDefaultDialer(String packageName)
packageName
- to set the default dialer to..public String getSystemDialerPackage()
public boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number)
android.Manifest.permission#READ_PHONE_STATE
accountHandle
- The handle for the account to check the voicemail number againstnumber
- The number to look up.public String getVoiceMailNumber(PhoneAccountHandle accountHandle)
android.Manifest.permission#READ_PHONE_STATE
accountHandle
- The handle for the phone account.null
if one has not been
configured.public String getLine1Number(PhoneAccountHandle accountHandle)
android.Manifest.permission#READ_PHONE_STATE
accountHandle
- The handle for the account retrieve a number for.public boolean isInCall()
Requires permission: android.Manifest.permission#READ_PHONE_STATE
public int getCallState()
TelephonyManager.CALL_STATE_RINGING
TelephonyManager.CALL_STATE_OFFHOOK
TelephonyManager.CALL_STATE_IDLE
Note that this API does not require the
android.Manifest.permission#READ_PHONE_STATE
permission. This is intentional, to
preserve the behavior of TelephonyManager.getCallState()
, which also did not require
the permission.public boolean isRinging()
public boolean endCall()
public void acceptRingingCall()
VideoProfile.STATE_BIDIRECTIONAL
will be answered, accepting that state.public void acceptRingingCall(int videoState)
videoState
- The desired video state to answer the call with.public void silenceRinger()
android.Manifest.permission#MODIFY_PHONE_STATE
public boolean isTtySupported()
public int getCurrentTtyMode()
TTY_MODE_OFF
- TTY_MODE_FULL
- TTY_MODE_HCO
- TTY_MODE_VCO
public void addNewIncomingCall(PhoneAccountHandle phoneAccount, Bundle extras)
ConnectionService
should invoke this method when it
has an incoming call. The specified PhoneAccountHandle
must have been registered
with registerPhoneAccount(android.telecom.PhoneAccount)
and the user must have enabled the corresponding
PhoneAccount
. This can be checked using getPhoneAccount(android.telecom.PhoneAccountHandle)
. 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(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
) before starting the incoming
call UI.
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.
phoneAccount
- A PhoneAccountHandle
registered with
registerPhoneAccount(android.telecom.PhoneAccount)
.extras
- A bundle that will be passed through to
ConnectionService.onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
.public void addNewUnknownCall(PhoneAccountHandle phoneAccount, Bundle extras)
phoneAccount
- A PhoneAccountHandle
registered with
registerPhoneAccount(android.telecom.PhoneAccount)
.extras
- A bundle that will be passed through to
ConnectionService.onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
.public boolean handleMmi(String dialString)
Requires that the method-caller be set as the system dialer app.
Requires permission:android.Manifest.permission#MODIFY_PHONE_STATE
dialString
- The digits to dial.public boolean handleMmi(String dialString, PhoneAccountHandle accountHandle)
Requires that the method-caller be set as the system dialer app.
Requires permission:android.Manifest.permission#MODIFY_PHONE_STATE
accountHandle
- The handle for the account the MMI code should apply to.dialString
- The digits to dial.public Uri getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle)
android.Manifest.permission#MODIFY_PHONE_STATE
accountHandle
- The handle for the account to derive an adn query URI for or
null
to return a URI which will use the default account.PhoneAccount
for the the content retrieve.public void cancelMissedCallsNotification()
Requires that the method-caller be set as the system dialer app.
Requires permission:android.Manifest.permission#MODIFY_PHONE_STATE
public void showInCallScreen(boolean showDialpad)
Requires that the method-caller be set as the system dialer app or have the
android.Manifest.permission#READ_PHONE_STATE
permission.
showDialpad
- Brings up the in-call dialpad as part of showing the in-call screen.public void placeCall(Uri address, Bundle extras)
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.
Requires permission: android.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.
address
- The address to make the call to.extras
- Bundle of extras to use with the call.public void enablePhoneAccount(PhoneAccountHandle handle, boolean isEnabled)
handle
- Handle to the phone account.isEnabled
- Enable state of the phone account.public TelecomAnalytics dumpAnalytics()
public Intent createManageBlockedNumbersIntent()
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.