# Print output for @column tags ?>
public
class
TelephonyManager
extends Object
java.lang.Object | |
↳ | android.telephony.TelephonyManager |
Provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information. Applications can also register a listener to receive notification of telephony state changes.
The returned TelephonyManager will use the default subscription for all calls.
To call an API for a specific subscription, use createForSubscriptionId(int)
. e.g.
telephonyManager = defaultSubTelephonyManager.createForSubscriptionId(subId);
Note that access to some telephony information is permission-protected. Your application cannot access the protected information unless it has the appropriate permissions declared in its manifest file. Where permissions apply, they are noted in the the methods through which you access the protected information.
TelephonyManager is intended for use on devices that implement
FEATURE_TELEPHONY
. On devices
that do not implement this feature, the behavior is not reliable.
Nested classes | |
---|---|
class |
TelephonyManager.CellInfoCallback
Callback for providing asynchronous |
class |
TelephonyManager.UssdResponseCallback
Used to notify callers of
|
Constants | |
---|---|
String |
ACTION_CARRIER_MESSAGING_CLIENT_SERVICE
A service action that identifies
a |
String |
ACTION_CONFIGURE_VOICEMAIL
Open the voicemail settings activity to make changes to voicemail configuration. |
String |
ACTION_MULTI_SIM_CONFIG_CHANGED
Broadcast action to be received by Broadcast receivers. |
String |
ACTION_NETWORK_COUNTRY_CHANGED
Broadcast intent action for network country code changes. |
String |
ACTION_PHONE_STATE_CHANGED
Broadcast intent action indicating that the call state on the device has changed. |
String |
ACTION_RESPOND_VIA_MESSAGE
The Phone app sends this intent when a user opts to respond-via-message during an incoming call. |
String |
ACTION_SECRET_CODE
Broadcast Action: A debug code has been entered in the dialer. |
String |
ACTION_SHOW_VOICEMAIL_NOTIFICATION
Broadcast intent action for letting the default dialer to know to show voicemail notification. |
String |
ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
Broadcast Action: The subscription carrier identity has changed. |
String |
ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
Broadcast Action: The subscription specific carrier identity has changed. |
int |
APPTYPE_CSIM
UICC application type is CSIM |
int |
APPTYPE_ISIM
UICC application type is ISIM |
int |
APPTYPE_RUIM
UICC application type is RUIM |
int |
APPTYPE_SIM
UICC application type is SIM |
int |
APPTYPE_USIM
UICC application type is USIM |
int |
AUTHTYPE_EAP_AKA
Authentication type for UICC challenge is EAP AKA. |
int |
AUTHTYPE_EAP_SIM
Authentication type for UICC challenge is EAP SIM. |
int |
CALL_STATE_IDLE
Device call state: No activity. |
int |
CALL_STATE_OFFHOOK
Device call state: Off-hook. |
int |
CALL_STATE_RINGING
Device call state: Ringing. |
int |
CDMA_ROAMING_MODE_AFFILIATED
Value for |
int |
CDMA_ROAMING_MODE_ANY
Value for |
int |
CDMA_ROAMING_MODE_HOME
Value for |
int |
CDMA_ROAMING_MODE_RADIO_DEFAULT
Value for |
int |
DATA_ACTIVITY_DORMANT
Data connection is active, but physical link is down |
int |
DATA_ACTIVITY_IN
Data connection activity: Currently receiving IP PPP traffic. |
int |
DATA_ACTIVITY_INOUT
Data connection activity: Currently both sending and receiving IP PPP traffic. |
int |
DATA_ACTIVITY_NONE
Data connection activity: No traffic. |
int |
DATA_ACTIVITY_OUT
Data connection activity: Currently sending IP PPP traffic. |
int |
DATA_CONNECTED
Data connection state: Connected. |
int |
DATA_CONNECTING
Data connection state: Currently setting up a data connection. |
int |
DATA_DISCONNECTED
Data connection state: Disconnected. |
int |
DATA_DISCONNECTING
Data connection state: Disconnecting. |
int |
DATA_SUSPENDED
Data connection state: Suspended. |
int |
DATA_UNKNOWN
Data connection state: Unknown. |
String |
EXTRA_ACTIVE_SIM_SUPPORTED_COUNT
The number of active SIM supported by current multi-SIM config. |
String |
EXTRA_CALL_VOICEMAIL_INTENT
The intent to call voicemail. |
String |
EXTRA_CARRIER_ID
An int extra used with |
String |
EXTRA_CARRIER_NAME
An string extra used with |
String |
EXTRA_HIDE_PUBLIC_SETTINGS
The boolean value indicating whether the voicemail settings activity launched by |
String |
EXTRA_INCOMING_NUMBER
This constant is deprecated.
Companion apps for wearable devices should use the |
String |
EXTRA_IS_REFRESH
Boolean value representing whether the |
String |
EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT
The intent to launch voicemail settings. |
String |
EXTRA_NETWORK_COUNTRY
The extra used with an |
String |
EXTRA_NOTIFICATION_COUNT
The number of voice messages associated with the notification. |
String |
EXTRA_PHONE_ACCOUNT_HANDLE
The extra used with an |
String |
EXTRA_SPECIFIC_CARRIER_ID
An int extra used with |
String |
EXTRA_SPECIFIC_CARRIER_NAME
An string extra used with |
String |
EXTRA_STATE
The lookup key used with the |
String |
EXTRA_SUBSCRIPTION_ID
An int extra used with |
String |
EXTRA_VOICEMAIL_NUMBER
The voicemail number. |
String |
METADATA_HIDE_VOICEMAIL_SETTINGS_MENU
A boolean meta-data value indicating whether the voicemail settings should be hidden in the
call settings page launched by
|
int |
MULTISIM_ALLOWED
The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported. |
int |
MULTISIM_NOT_SUPPORTED_BY_CARRIER
The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported by the hardware, but restricted by the carrier. |
int |
MULTISIM_NOT_SUPPORTED_BY_HARDWARE
The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is not supported by the hardware. |
int |
NETWORK_SELECTION_MODE_AUTO
|
int |
NETWORK_SELECTION_MODE_MANUAL
|
int |
NETWORK_SELECTION_MODE_UNKNOWN
|
int |
NETWORK_TYPE_1xRTT
Current network is 1xRTT |
int |
NETWORK_TYPE_CDMA
Current network is CDMA: Either IS95A or IS95B |
int |
NETWORK_TYPE_EDGE
Current network is EDGE |
int |
NETWORK_TYPE_EHRPD
Current network is eHRPD |
int |
NETWORK_TYPE_EVDO_0
Current network is EVDO revision 0 |
int |
NETWORK_TYPE_EVDO_A
Current network is EVDO revision A |
int |
NETWORK_TYPE_EVDO_B
Current network is EVDO revision B |
int |
NETWORK_TYPE_GPRS
Current network is GPRS |
int |
NETWORK_TYPE_GSM
Current network is GSM |
int |
NETWORK_TYPE_HSDPA
Current network is HSDPA |
int |
NETWORK_TYPE_HSPA
Current network is HSPA |
int |
NETWORK_TYPE_HSPAP
Current network is HSPA+ |
int |
NETWORK_TYPE_HSUPA
Current network is HSUPA |
int |
NETWORK_TYPE_IDEN
Current network is iDen |
int |
NETWORK_TYPE_IWLAN
Current network is IWLAN |
int |
NETWORK_TYPE_LTE
Current network is LTE |
int |
NETWORK_TYPE_NR
Current network is NR(New Radio) 5G. |
int |
NETWORK_TYPE_TD_SCDMA
Current network is TD_SCDMA |
int |
NETWORK_TYPE_UMTS
Current network is UMTS |
int |
NETWORK_TYPE_UNKNOWN
Network type is unknown |
int |
PHONE_TYPE_CDMA
Phone radio is CDMA. |
int |
PHONE_TYPE_GSM
Phone radio is GSM. |
int |
PHONE_TYPE_NONE
No phone radio. |
int |
PHONE_TYPE_SIP
Phone is via SIP. |
int |
SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION
The subscription is not valid. |
int |
SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE
The subscription is not valid. |
int |
SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION
Subscription service happened remote exception. |
int |
SET_OPPORTUNISTIC_SUB_SUCCESS
No error. |
int |
SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED
Validation failed when trying to switch to preferred subscription. |
int |
SIM_STATE_ABSENT
SIM card state: no SIM card is available in the device |
int |
SIM_STATE_CARD_IO_ERROR
SIM card state: SIM Card Error, present but faulty |
int |
SIM_STATE_CARD_RESTRICTED
SIM card state: SIM Card restricted, present but not usable due to carrier restrictions. |
int |
SIM_STATE_NETWORK_LOCKED
SIM card state: Locked: requires a network PIN to unlock |
int |
SIM_STATE_NOT_READY
SIM card state: SIM Card is NOT READY |
int |
SIM_STATE_PERM_DISABLED
SIM card state: SIM Card Error, permanently disabled |
int |
SIM_STATE_PIN_REQUIRED
SIM card state: Locked: requires the user's SIM PIN to unlock |
int |
SIM_STATE_PUK_REQUIRED
SIM card state: Locked: requires the user's SIM PUK to unlock |
int |
SIM_STATE_READY
SIM card state: Ready |
int |
SIM_STATE_UNKNOWN
SIM card state: Unknown. |
int |
UNINITIALIZED_CARD_ID
A UICC card identifier used before the UICC card is loaded. |
int |
UNKNOWN_CARRIER_ID
An unknown carrier id. |
int |
UNSUPPORTED_CARD_ID
A UICC card identifier used if the device does not support the operation. |
int |
UPDATE_AVAILABLE_NETWORKS_ABORTED
The request is aborted. |
int |
UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL
Disable modem fail. |
int |
UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL
Enable modem fail. |
int |
UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS
The parameter passed in is invalid. |
int |
UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED
Carrier app does not support multiple available networks. |
int |
UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE
No carrier privilege. |
int |
UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE
The subscription is not valid. |
int |
UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION
There is no OpportunisticNetworkService. |
int |
UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED
OpportunisticNetworkService is disabled. |
int |
UPDATE_AVAILABLE_NETWORKS_SUCCESS
No error. |
int |
UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE
There is a unknown failure happened. |
int |
USSD_ERROR_SERVICE_UNAVAIL
Failure code returned when a USSD request has failed to execute because the Telephony service is unavailable. |
int |
USSD_RETURN_FAILURE
Failed code returned when the mobile network has failed to complete a USSD request. |
String |
VVM_TYPE_CVVM
A flavor of OMTP protocol with a different mobile originated (MO) format |
String |
VVM_TYPE_OMTP
The OMTP protocol. |
Fields | |
---|---|
public
static
final
String |
EXTRA_STATE_IDLE
Value used with |
public
static
final
String |
EXTRA_STATE_OFFHOOK
Value used with |
public
static
final
String |
EXTRA_STATE_RINGING
Value used with |
Public methods | |
---|---|
boolean
|
canChangeDtmfToneLength()
Whether the device supports configuring the DTMF tone length. |
TelephonyManager
|
createForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle)
Create a new TelephonyManager object pinned to the subscription ID associated with the given phone account. |
TelephonyManager
|
createForSubscriptionId(int subId)
Create a new TelephonyManager object pinned to the given subscription ID. |
boolean
|
doesSwitchMultiSimConfigTriggerReboot()
Get whether making changes to modem configurations by |
int
|
getActiveModemCount()
Returns the number of logical modems currently configured to be activated. |
List<CellInfo>
|
getAllCellInfo()
Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells. |
int
|
getCallState()
Returns the state of all calls on the device. |
int
|
getCardIdForDefaultEuicc()
Get the card ID of the default eUICC card. |
PersistableBundle
|
getCarrierConfig()
Returns the carrier config of the subscription ID pinned to the TelephonyManager. |
int
|
getCarrierIdFromSimMccMnc()
Returns carrier id based on sim MCCMNC (returned by |
CellLocation
|
getCellLocation()
This method is deprecated.
use |
int
|
getDataActivity()
Returns a constant indicating the type of activity on a data connection (cellular). |
int
|
getDataNetworkType()
Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission. |
int
|
getDataState()
Returns a constant indicating the current data connection state (cellular). |
String
|
getDeviceId()
This method is deprecated.
Use |
String
|
getDeviceId(int slotIndex)
This method is deprecated.
Use |
String
|
getDeviceSoftwareVersion()
Returns the software version number for the device, for example, the IMEI/SV for GSM phones. |
Map<Integer, List<EmergencyNumber>>
|
getEmergencyNumberList()
Get the emergency number list based on current locale, sim, default, modem and network. |
Map<Integer, List<EmergencyNumber>>
|
getEmergencyNumberList(int categories)
Get the per-category emergency number list based on current locale, sim, default, modem and network. |
String[]
|
getForbiddenPlmns()
Returns an array of Forbidden PLMNs from the USIM App Returns null if the query fails. |
String
|
getGroupIdLevel1()
Returns the Group Identifier Level1 for a GSM phone. |
String
|
getIccAuthentication(int appType, int authType, String data)
Returns the response of authentication for the default subscription. |
String
|
getImei(int slotIndex)
Returns the IMEI (International Mobile Equipment Identity). |
String
|
getImei()
Returns the IMEI (International Mobile Equipment Identity). |
String
|
getLine1Number()
Returns the phone number string for line 1, for example, the MSISDN for a GSM phone for a particular subscription. |
String
|
getManualNetworkSelectionPlmn()
Get the PLMN chosen for Manual Network Selection if active. |
String
|
getManufacturerCode(int slotIndex)
Returns the Manufacturer Code from the MEID. |
String
|
getManufacturerCode()
Returns the Manufacturer Code from the MEID. |
String
|
getMeid()
Returns the MEID (Mobile Equipment Identifier). |
String
|
getMeid(int slotIndex)
Returns the MEID (Mobile Equipment Identifier). |
String
|
getMmsUAProfUrl()
Returns the MMS user agent profile URL. |
String
|
getMmsUserAgent()
Returns the MMS user agent. |
String
|
getNai()
Returns the Network Access Identifier (NAI). |
String
|
getNetworkCountryIso()
Returns the ISO-3166-1 alpha-2 country code equivalent of the MCC (Mobile Country Code) of the current registered operator or the cell nearby, if available. |
String
|
getNetworkCountryIso(int slotIndex)
Returns the ISO-3166-1 alpha-2 country code equivalent of the MCC (Mobile Country Code) of the current registered operator or the cell nearby, if available. |
String
|
getNetworkOperator()
Returns the numeric name (MCC+MNC) of current registered operator. |
String
|
getNetworkOperatorName()
Returns the alphabetic name of current registered operator. |
int
|
getNetworkSelectionMode()
Get the network selection mode. |
String
|
getNetworkSpecifier()
Returns the network specifier of the subscription ID pinned to the TelephonyManager. |
int
|
getNetworkType()
This method is deprecated.
use |
int
|
getPhoneCount()
This method is deprecated.
Use |
int
|
getPhoneType()
Returns a constant indicating the device phone type. |
int
|
getPreferredOpportunisticDataSubscription()
Get preferred opportunistic data subscription Id Requires that the calling app has carrier privileges (see |
ServiceState
|
getServiceState()
Returns the current |
SignalStrength
|
getSignalStrength()
Get the most recently available signal strength information. |
int
|
getSimCarrierId()
Returns carrier id of the current subscription. |
CharSequence
|
getSimCarrierIdName()
Returns carrier id name of the current subscription. |
String
|
getSimCountryIso()
Returns the ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code. |
String
|
getSimOperator()
Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM. |
String
|
getSimOperatorName()
Returns the Service Provider Name (SPN). |
String
|
getSimSerialNumber()
Returns the serial number of the SIM, if applicable. |
int
|
getSimSpecificCarrierId()
Returns fine-grained carrier ID of the current subscription. |
CharSequence
|
getSimSpecificCarrierIdName()
Similar like |
int
|
getSimState()
Returns a constant indicating the state of the default SIM card. |
int
|
getSimState(int slotIndex)
Returns a constant indicating the state of the device SIM card in a logical slot. |
String
|
getSubscriberId()
Returns the unique subscriber ID, for example, the IMSI for a GSM phone. |
int
|
getSubscriptionId(PhoneAccountHandle phoneAccountHandle)
Returns the subscription ID for the given phone account handle. |
int
|
getSubscriptionId()
Return an appropriate subscription ID for any situation. |
int
|
getSupportedModemCount()
Return how many logical modem can be potentially active simultaneously, in terms of hardware capability. |
String
|
getTypeAllocationCode()
Returns the Type Allocation Code from the IMEI. |
String
|
getTypeAllocationCode(int slotIndex)
Returns the Type Allocation Code from the IMEI. |
List<UiccCardInfo>
|
getUiccCardsInfo()
Gets information about currently inserted UICCs and eUICCs. |
String
|
getVisualVoicemailPackageName()
Returns the package responsible of processing visual voicemail for the subscription ID pinned to the TelephonyManager. |
String
|
getVoiceMailAlphaTag()
Retrieves the alphabetic identifier associated with the voice mail number. |
String
|
getVoiceMailNumber()
Returns the voice mail number. |
int
|
getVoiceNetworkType()
Returns the NETWORK_TYPE_xxxx for voice Requires Permission: |
Uri
|
getVoicemailRingtoneUri(PhoneAccountHandle accountHandle)
Returns the URI for the per-account voicemail ringtone set in Phone settings. |
boolean
|
hasCarrierPrivileges()
Has the calling application been granted carrier privileges by the carrier. |
boolean
|
hasIccCard()
|
boolean
|
iccCloseLogicalChannel(int channel)
This method is deprecated.
Use |
byte[]
|
iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3, String filePath)
This method is deprecated.
Use |
IccOpenLogicalChannelResponse
|
iccOpenLogicalChannel(String AID, int p2)
This method is deprecated.
Use |
IccOpenLogicalChannelResponse
|
iccOpenLogicalChannel(String AID)
This method is deprecated.
Replaced by |
String
|
iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2, int p3, String data)
This method is deprecated.
Use |
String
|
iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2, int p3, String data)
This method is deprecated.
Use |
boolean
|
isConcurrentVoiceAndDataSupported()
Whether the device is currently on a technology (e.g. UMTS or LTE) which can support voice and data simultaneously. |
boolean
|
isDataEnabled()
Returns whether mobile data is enabled or not per user setting. |
boolean
|
isDataRoamingEnabled()
Returns whether mobile data roaming is enabled on the subscription. |
boolean
|
isEmergencyNumber(String number)
Identifies if the supplied phone number is an emergency number that matches a known emergency number based on current locale, SIM card(s), Android database, modem, network, or defaults. |
boolean
|
isHearingAidCompatibilitySupported()
Whether the phone supports hearing aid compatibility. |
boolean
|
isManualNetworkSelectionAllowed()
Checks if manual network selection is allowed. |
boolean
|
isModemEnabledForSlot(int slotIndex)
It indicates whether modem is enabled or not per slot. |
int
|
isMultiSimSupported()
Returns if the usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported by the device and by the carrier. |
boolean
|
isNetworkRoaming()
Returns true if the device is considered roaming on the current network, for GSM purposes. |
boolean
|
isRttSupported()
Determines whether the device currently supports RTT (Real-time text). |
boolean
|
isSmsCapable()
|
boolean
|
isTtyModeSupported()
This method is deprecated.
Use |
boolean
|
isVoiceCapable()
|
boolean
|
isVoicemailVibrationEnabled(PhoneAccountHandle accountHandle)
Returns whether vibration is set for voicemail notification in Phone settings. |
boolean
|
isWorldPhone()
Whether the device is a world phone. |
void
|
listen(PhoneStateListener listener, int events)
Registers a listener object to receive notification of changes in specified telephony states. |
void
|
requestCellInfoUpdate(Executor executor, TelephonyManager.CellInfoCallback callback)
Requests all available cell information from the current subscription for observed camped/registered, serving, and neighboring cells. |
NetworkScan
|
requestNetworkScan(NetworkScanRequest request, Executor executor, TelephonyScanManager.NetworkScanCallback callback)
Request a network scan. |
void
|
sendDialerSpecialCode(String inputCode)
Send the special dialer code. |
String
|
sendEnvelopeWithStatus(String content)
This method is deprecated.
Use |
void
|
sendUssdRequest(String ussdRequest, TelephonyManager.UssdResponseCallback callback, Handler handler)
Sends an Unstructured Supplementary Service Data (USSD) request to the mobile network and
informs the caller of the response via the supplied |
void
|
sendVisualVoicemailSms(String number, int port, String text, PendingIntent sentIntent)
Send a visual voicemail SMS. |
void
|
setDataEnabled(boolean enable)
Turns mobile data on or off. |
int
|
setForbiddenPlmns(List<String> fplmns)
Replace the contents of the forbidden PLMN SIM file with the provided values. |
boolean
|
setLine1NumberForDisplay(String alphaTag, String number)
Set the line 1 phone number string and its alphatag for the current ICCID for display purpose only, for example, displayed in Phone Status. |
void
|
setNetworkSelectionModeAutomatic()
Sets the network selection mode to automatic. |
boolean
|
setNetworkSelectionModeManual(String operatorNumeric, boolean persistSelection, int ran)
Ask the radio to connect to the input network and change selection mode to manual. |
boolean
|
setNetworkSelectionModeManual(String operatorNumeric, boolean persistSelection)
Ask the radio to connect to the input network and change selection mode to manual. |
boolean
|
setOperatorBrandOverride(String brand)
Override the branding for the current ICCID. |
boolean
|
setPreferredNetworkTypeToGlobal()
Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA. |
void
|
setPreferredOpportunisticDataSubscription(int subId, boolean needValidation, Executor executor, Consumer<Integer> callback)
Set preferred opportunistic data subscription id. |
void
|
setVisualVoicemailSmsFilterSettings(VisualVoicemailSmsFilterSettings settings)
Set the visual voicemail SMS filter settings for the subscription ID pinned to the TelephonyManager. |
boolean
|
setVoiceMailNumber(String alphaTag, String number)
Sets the voice mail number. |
void
|
setVoicemailRingtoneUri(PhoneAccountHandle phoneAccountHandle, Uri uri)
This method is deprecated.
Use |
void
|
setVoicemailVibrationEnabled(PhoneAccountHandle phoneAccountHandle, boolean enabled)
This method is deprecated.
Use |
void
|
switchMultiSimConfig(int numOfSims)
Switch configs to enable multi-sim or switch back to single-sim Requires Permission:
|
void
|
updateAvailableNetworks(List<AvailableNetworkInfo> availableNetworks, Executor executor, Consumer<Integer> callback)
Update availability of a list of networks in the current location. |
Inherited methods | |
---|---|
public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE
A service action that identifies
a CarrierMessagingClientService
subclass in the
AndroidManifest.xml.
See CarrierMessagingClientService
for the details.
Constant Value: "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE"
public static final String ACTION_CONFIGURE_VOICEMAIL
Open the voicemail settings activity to make changes to voicemail configuration.
The EXTRA_PHONE_ACCOUNT_HANDLE
extra indicates which PhoneAccountHandle
to
configure voicemail.
The EXTRA_HIDE_PUBLIC_SETTINGS
hides settings the dialer will modify through public
API if set.
Constant Value: "android.telephony.action.CONFIGURE_VOICEMAIL"
public static final String ACTION_MULTI_SIM_CONFIG_CHANGED
Broadcast action to be received by Broadcast receivers.
Indicates multi-SIM configuration is changed. For example, it changed
from single SIM capable to dual-SIM capable (DSDS or DSDA) or triple-SIM mode.
It doesn't indicate how many subscriptions are actually active, or which states SIMs are,
or that all steps during multi-SIM change are done. To know those information you still need
to listen to SIM_STATE changes or active subscription changes.
See extra of EXTRA_ACTIVE_SIM_SUPPORTED_COUNT
for updated value.
Constant Value: "android.telephony.action.MULTI_SIM_CONFIG_CHANGED"
public static final String ACTION_NETWORK_COUNTRY_CHANGED
Broadcast intent action for network country code changes.
The EXTRA_NETWORK_COUNTRY
extra indicates the country code of the current
network returned by getNetworkCountryIso()
.
There may be a delay of several minutes before reporting that no country is detected.
Constant Value: "android.telephony.action.NETWORK_COUNTRY_CHANGED"
public static final String ACTION_PHONE_STATE_CHANGED
Broadcast intent action indicating that the call state on the device has changed.
The EXTRA_STATE
extra indicates the new call state.
If a receiving app has Manifest.permission.READ_CALL_LOG
permission, a second
extra EXTRA_INCOMING_NUMBER
provides the phone number for incoming and outgoing
calls as a String.
If the receiving app has
Manifest.permission.READ_CALL_LOG
and
Manifest.permission.READ_PHONE_STATE
permission, it will receive the
broadcast twice; one with the EXTRA_INCOMING_NUMBER
populated with the phone number,
and another with it blank. Due to the nature of broadcasts, you cannot assume the order
in which these broadcasts will arrive, however you are guaranteed to receive two in this
case. Apps which are interested in the EXTRA_INCOMING_NUMBER
can ignore the
broadcasts where EXTRA_INCOMING_NUMBER
is not present in the extras (e.g. where
Intent#hasExtra(String)
returns false
).
This was a sticky
broadcast in version 1.0, but it is no longer sticky.
Instead, use getCallState()
to synchronously query the current call state.
Requires Manifest.permission.READ_PHONE_STATE
Constant Value: "android.intent.action.PHONE_STATE"
public static final String ACTION_RESPOND_VIA_MESSAGE
The Phone app sends this intent when a user opts to respond-via-message during an incoming
call. By default, the device's default SMS app consumes this message and sends a text message
to the caller. A third party app can also provide this functionality by consuming this Intent
with a Service
and sending the message using its own messaging system.
The intent contains a URI (available from Intent.getData()
)
describing the recipient, using either the sms:
, smsto:
, mms:
,
or mmsto:
URI schema. Each of these URI schema carry the recipient information the
same way: the path part of the URI contains the recipient's phone number or a comma-separated
set of phone numbers if there are multiple recipients. For example, smsto:2065551234
.
The intent may also contain extras for the message text (in Intent.EXTRA_TEXT
) and a message subject
(in Intent.EXTRA_SUBJECT
).
Note:
The intent-filter that consumes this Intent needs to be in a Service
that requires the
permission Manifest.permission.SEND_RESPOND_VIA_MESSAGE
.
For example, the service that receives this intent can be declared in the manifest file with an intent filter like this:
<!-- Service that delivers SMS messages received from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service>
Output: nothing.
Constant Value: "android.intent.action.RESPOND_VIA_MESSAGE"
public static final String ACTION_SECRET_CODE
Broadcast Action: A debug code has been entered in the dialer.
This intent is broadcast by the system and OEM telephony apps may need to receive these
broadcasts. And it requires the sender to be default dialer or has carrier privileges
(see hasCarrierPrivileges()
).
These "secret codes" are used to activate developer menus by dialing certain codes.
And they are of the form *#*#<code>#*#*
. The intent will have the data
URI: android_secret_code://<code>
. It is possible that a manifest
receiver would be woken up even if it is not currently running.
It is supposed to replace Telephony.Sms.Intents.SECRET_CODE_ACTION
in the next Android version.
Before that both of these two actions will be broadcast.
Constant Value: "android.telephony.action.SECRET_CODE"
public static final String ACTION_SHOW_VOICEMAIL_NOTIFICATION
Broadcast intent action for letting the default dialer to know to show voicemail notification.
The EXTRA_PHONE_ACCOUNT_HANDLE
extra indicates which PhoneAccountHandle
the
voicemail is received on.
The EXTRA_NOTIFICATION_COUNT
extra indicates the total numbers of unheard
voicemails.
The EXTRA_VOICEMAIL_NUMBER
extra indicates the voicemail number if available.
The EXTRA_CALL_VOICEMAIL_INTENT
extra is a PendingIntent
that
will call the voicemail number when sent. This extra will be empty if the voicemail number
is not set, and EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT
will be set instead.
The EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT
extra is a
PendingIntent
that will launch the voicemail settings. This extra is only
available when the voicemail number is not set.
The EXTRA_IS_REFRESH
extra indicates whether the notification is a refresh or a new
notification.
See also:
Constant Value: "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION"
public static final String ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
Broadcast Action: The subscription carrier identity has changed. This intent could be sent on the following events:
TelephonyManager#UNKNOWN_CARRIER_ID
.TelephonyManager#UNKNOWN_CARRIER_ID
to a valid id.EXTRA_CARRIER_ID
The up-to-date carrier id of the current subscription id.
EXTRA_CARRIER_NAME
The up-to-date carrier name of the current subscription.
EXTRA_SUBSCRIPTION_ID
The subscription id associated with the changed carrier
identity.
This is a protected intent that can only be sent by the system.
Constant Value: "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED"
public static final String ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
Broadcast Action: The subscription specific carrier identity has changed.
A specific carrier ID returns the fine-grained carrier ID of the current subscription.
It can represent the fact that a carrier may be in effect an aggregation of other carriers
(ie in an MVNO type scenario) where each of these specific carriers which are used to make
up the actual carrier service may have different carrier configurations.
A specific carrier ID could also be used, for example, in a scenario where a carrier requires
different carrier configuration for different service offering such as a prepaid plan.
the specific carrier ID would be used for configuration purposes, but apps wishing to know
about the carrier itself should use the regular carrier ID returned by
getSimCarrierId()
.
Similar like ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
, this intent will be
sent on the event of ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
while its also
possible to be sent without ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
when
specific carrier ID changes while carrier ID remains the same.
e.g, the same subscription switches to different IMSI could potentially change its
specific carrier ID while carrier id remains the same.
See also:
getSimSpecificCarrierId()
The intent will have the following extra values:
- {@link #EXTRA_SPECIFIC_CARRIER_ID} The up-to-date specific carrier id of the
current subscription.
- {@link #EXTRA_SPECIFIC_CARRIER_NAME} The up-to-date name of the specific carrier id.
- {@link #EXTRA_SUBSCRIPTION_ID} The subscription id associated with the changed carrier
identity.
This is a protected intent that can only be sent by the system.
Constant Value: "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED"
public static final int APPTYPE_CSIM
UICC application type is CSIM
Constant Value: 4 (0x00000004)
public static final int APPTYPE_ISIM
UICC application type is ISIM
Constant Value: 5 (0x00000005)
public static final int APPTYPE_RUIM
UICC application type is RUIM
Constant Value: 3 (0x00000003)
public static final int APPTYPE_SIM
UICC application type is SIM
Constant Value: 1 (0x00000001)
public static final int APPTYPE_USIM
UICC application type is USIM
Constant Value: 2 (0x00000002)
public static final int AUTHTYPE_EAP_AKA
Authentication type for UICC challenge is EAP AKA. See RFC 4187 for details.
Constant Value: 129 (0x00000081)
public static final int AUTHTYPE_EAP_SIM
Authentication type for UICC challenge is EAP SIM. See RFC 4186 for details.
Constant Value: 128 (0x00000080)
public static final int CALL_STATE_IDLE
Device call state: No activity.
Constant Value: 0 (0x00000000)
public static final int CALL_STATE_OFFHOOK
Device call state: Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting.
Constant Value: 2 (0x00000002)
public static final int CALL_STATE_RINGING
Device call state: Ringing. A new call arrived and is ringing or waiting. In the latter case, another call is already active.
Constant Value: 1 (0x00000001)
public static final int CDMA_ROAMING_MODE_AFFILIATED
Value for CarrierConfigManager#KEY_CDMA_ROAMING_MODE_INT
which permits roaming on
affiliated networks.
Constant Value: 1 (0x00000001)
public static final int CDMA_ROAMING_MODE_ANY
Value for CarrierConfigManager#KEY_CDMA_ROAMING_MODE_INT
which permits roaming on
any network.
Constant Value: 2 (0x00000002)
public static final int CDMA_ROAMING_MODE_HOME
Value for CarrierConfigManager#KEY_CDMA_ROAMING_MODE_INT
which only permits
connections on home networks.
Constant Value: 0 (0x00000000)
public static final int CDMA_ROAMING_MODE_RADIO_DEFAULT
Value for CarrierConfigManager#KEY_CDMA_ROAMING_MODE_INT
which leaves the roaming
mode set to the radio default or to the user's preference if they've indicated one.
Constant Value: -1 (0xffffffff)
public static final int DATA_ACTIVITY_DORMANT
Data connection is active, but physical link is down
Constant Value: 4 (0x00000004)
public static final int DATA_ACTIVITY_IN
Data connection activity: Currently receiving IP PPP traffic.
Constant Value: 1 (0x00000001)
public static final int DATA_ACTIVITY_INOUT
Data connection activity: Currently both sending and receiving IP PPP traffic.
Constant Value: 3 (0x00000003)
public static final int DATA_ACTIVITY_NONE
Data connection activity: No traffic.
Constant Value: 0 (0x00000000)
public static final int DATA_ACTIVITY_OUT
Data connection activity: Currently sending IP PPP traffic.
Constant Value: 2 (0x00000002)
public static final int DATA_CONNECTED
Data connection state: Connected. IP traffic should be available.
Constant Value: 2 (0x00000002)
public static final int DATA_CONNECTING
Data connection state: Currently setting up a data connection.
Constant Value: 1 (0x00000001)
public static final int DATA_DISCONNECTED
Data connection state: Disconnected. IP traffic not available.
Constant Value: 0 (0x00000000)
public static final int DATA_DISCONNECTING
Data connection state: Disconnecting. IP traffic may be available but will cease working imminently.
Constant Value: 4 (0x00000004)
public static final int DATA_SUSPENDED
Data connection state: Suspended. The connection is up, but IP traffic is temporarily unavailable. For example, in a 2G network, data activity may be suspended when a voice call arrives.
Constant Value: 3 (0x00000003)
public static final int DATA_UNKNOWN
Data connection state: Unknown. Used before we know the state.
Constant Value: -1 (0xffffffff)
public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT
The number of active SIM supported by current multi-SIM config. It's not related to how many
SIM/subscriptions are currently active.
Same value will be returned by getActiveModemCount()
.
For single SIM mode, it's 1.
For DSDS or DSDA mode, it's 2.
For triple-SIM mode, it's 3.
Extra of ACTION_MULTI_SIM_CONFIG_CHANGED
.
type: integer
Constant Value: "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT"
public static final String EXTRA_CALL_VOICEMAIL_INTENT
The intent to call voicemail.
Constant Value: "android.telephony.extra.CALL_VOICEMAIL_INTENT"
public static final String EXTRA_CARRIER_ID
An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
which indicates
the updated carrier id returned by TelephonyManager#getSimCarrierId()
.
Will be TelephonyManager#UNKNOWN_CARRIER_ID
if the subscription is unavailable or
the carrier cannot be identified.
Constant Value: "android.telephony.extra.CARRIER_ID"
public static final String EXTRA_CARRIER_NAME
An string extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
which
indicates the updated carrier name of the current subscription.
Constant Value: "android.telephony.extra.CARRIER_NAME"
public static final String EXTRA_HIDE_PUBLIC_SETTINGS
The boolean value indicating whether the voicemail settings activity launched by ACTION_CONFIGURE_VOICEMAIL
should hide settings accessible through public API. This is
used by dialer implementations which provides their own voicemail settings UI, but still
needs to expose device specific voicemail settings to the user.
Constant Value: "android.telephony.extra.HIDE_PUBLIC_SETTINGS"
public static final String EXTRA_INCOMING_NUMBER
This constant is deprecated.
Companion apps for wearable devices should use the InCallService
API
to retrieve the phone number for calls instead. Apps performing call screening should use
the CallScreeningService
API instead.
Extra key used with the ACTION_PHONE_STATE_CHANGED
broadcast
for a String containing the incoming or outgoing phone number.
This extra is only populated for receivers of the ACTION_PHONE_STATE_CHANGED
broadcast which have been granted the Manifest.permission.READ_CALL_LOG
and
Manifest.permission.READ_PHONE_STATE
permissions.
For incoming calls, the phone number is only guaranteed to be populated when the
EXTRA_STATE
changes from EXTRA_STATE_IDLE
to EXTRA_STATE_RINGING
.
If the incoming caller is from an unknown number, the extra will be populated with an empty
string.
For outgoing calls, the phone number is only guaranteed to be populated when the
EXTRA_STATE
changes from EXTRA_STATE_IDLE
to EXTRA_STATE_OFFHOOK
.
Retrieve with
Intent.getStringExtra(String)
.
Constant Value: "incoming_number"
public static final String EXTRA_IS_REFRESH
Boolean value representing whether the TelephonyManager#ACTION_SHOW_VOICEMAIL_NOTIFICATION
is new or a refresh of an existing
notification. Notification refresh happens after reboot or connectivity changes. The user has
already been notified for the voicemail so it should not alert the user, and should not be
shown again if the user has dismissed it.
Constant Value: "android.telephony.extra.IS_REFRESH"
public static final String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT
The intent to launch voicemail settings.
Constant Value: "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT"
public static final String EXTRA_NETWORK_COUNTRY
The extra used with an ACTION_NETWORK_COUNTRY_CHANGED
to specify the
the country code in ISO-3166-1 alpha-2 format.
Retrieve with Intent.getStringExtra(String)
.
Constant Value: "android.telephony.extra.NETWORK_COUNTRY"
public static final String EXTRA_NOTIFICATION_COUNT
The number of voice messages associated with the notification.
Constant Value: "android.telephony.extra.NOTIFICATION_COUNT"
public static final String EXTRA_PHONE_ACCOUNT_HANDLE
The extra used with an ACTION_CONFIGURE_VOICEMAIL
and
ACTION_SHOW_VOICEMAIL_NOTIFICATION
Intent
to specify the
PhoneAccountHandle
the configuration or notification is for.
Retrieve with Intent.getParcelableExtra(String)
.
Constant Value: "android.telephony.extra.PHONE_ACCOUNT_HANDLE"
public static final String EXTRA_SPECIFIC_CARRIER_ID
An int extra used with ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
which
indicates the updated specific carrier id returned by
TelephonyManager#getSimSpecificCarrierId()
. Note, its possible specific carrier id
changes while ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
remains the same
e.g, when subscription switch to different IMSIs.
Will be TelephonyManager#UNKNOWN_CARRIER_ID
if the subscription is unavailable or
the carrier cannot be identified.
Constant Value: "android.telephony.extra.SPECIFIC_CARRIER_ID"
public static final String EXTRA_SPECIFIC_CARRIER_NAME
An string extra used with ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
which indicates the updated specific carrier name returned by
TelephonyManager#getSimSpecificCarrierIdName()
.
it's a user-facing name of the specific carrier id EXTRA_SPECIFIC_CARRIER_ID
e.g, Tracfone-AT&T
Constant Value: "android.telephony.extra.SPECIFIC_CARRIER_NAME"
public static final String EXTRA_STATE
The lookup key used with the ACTION_PHONE_STATE_CHANGED
broadcast
for a String containing the new call state.
Retrieve with
Intent.getStringExtra(String)
.
Constant Value: "state"
public static final String EXTRA_SUBSCRIPTION_ID
An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
to indicate the
subscription which has changed; or in general whenever a subscription ID needs specified.
Constant Value: "android.telephony.extra.SUBSCRIPTION_ID"
public static final String EXTRA_VOICEMAIL_NUMBER
The voicemail number.
Constant Value: "android.telephony.extra.VOICEMAIL_NUMBER"
public static final String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU
A boolean meta-data value indicating whether the voicemail settings should be hidden in the
call settings page launched by
TelecomManager.ACTION_SHOW_CALL_SETTINGS
.
Dialer implementations (see TelecomManager.getDefaultDialerPackage()
)
which would also like to manage voicemail settings should set this meta-data to true
in the manifest registration of their application.
See also:
Constant Value: "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU"
public static final int MULTISIM_ALLOWED
The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported.
Constant Value: 0 (0x00000000)
public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER
The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported by the hardware, but restricted by the carrier.
Constant Value: 2 (0x00000002)
public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE
The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is not supported by the hardware.
Constant Value: 1 (0x00000001)
public static final int NETWORK_SELECTION_MODE_AUTO
Constant Value: 1 (0x00000001)
public static final int NETWORK_SELECTION_MODE_MANUAL
Constant Value: 2 (0x00000002)
public static final int NETWORK_SELECTION_MODE_UNKNOWN
Constant Value: 0 (0x00000000)
public static final int NETWORK_TYPE_1xRTT
Current network is 1xRTT
Constant Value: 7 (0x00000007)
public static final int NETWORK_TYPE_CDMA
Current network is CDMA: Either IS95A or IS95B
Constant Value: 4 (0x00000004)
public static final int NETWORK_TYPE_EDGE
Current network is EDGE
Constant Value: 2 (0x00000002)
public static final int NETWORK_TYPE_EHRPD
Current network is eHRPD
Constant Value: 14 (0x0000000e)
public static final int NETWORK_TYPE_EVDO_0
Current network is EVDO revision 0
Constant Value: 5 (0x00000005)
public static final int NETWORK_TYPE_EVDO_A
Current network is EVDO revision A
Constant Value: 6 (0x00000006)
public static final int NETWORK_TYPE_EVDO_B
Current network is EVDO revision B
Constant Value: 12 (0x0000000c)
public static final int NETWORK_TYPE_GPRS
Current network is GPRS
Constant Value: 1 (0x00000001)
public static final int NETWORK_TYPE_GSM
Current network is GSM
Constant Value: 16 (0x00000010)
public static final int NETWORK_TYPE_HSDPA
Current network is HSDPA
Constant Value: 8 (0x00000008)
public static final int NETWORK_TYPE_HSPA
Current network is HSPA
Constant Value: 10 (0x0000000a)
public static final int NETWORK_TYPE_HSPAP
Current network is HSPA+
Constant Value: 15 (0x0000000f)
public static final int NETWORK_TYPE_HSUPA
Current network is HSUPA
Constant Value: 9 (0x00000009)
public static final int NETWORK_TYPE_IDEN
Current network is iDen
Constant Value: 11 (0x0000000b)
public static final int NETWORK_TYPE_IWLAN
Current network is IWLAN
Constant Value: 18 (0x00000012)
public static final int NETWORK_TYPE_LTE
Current network is LTE
Constant Value: 13 (0x0000000d)
public static final int NETWORK_TYPE_NR
Current network is NR(New Radio) 5G.
Constant Value: 20 (0x00000014)
public static final int NETWORK_TYPE_TD_SCDMA
Current network is TD_SCDMA
Constant Value: 17 (0x00000011)
public static final int NETWORK_TYPE_UMTS
Current network is UMTS
Constant Value: 3 (0x00000003)
public static final int NETWORK_TYPE_UNKNOWN
Network type is unknown
Constant Value: 0 (0x00000000)
public static final int PHONE_TYPE_CDMA
Phone radio is CDMA.
Constant Value: 2 (0x00000002)
public static final int PHONE_TYPE_GSM
Phone radio is GSM.
Constant Value: 1 (0x00000001)
public static final int PHONE_TYPE_NONE
No phone radio.
Constant Value: 0 (0x00000000)
public static final int PHONE_TYPE_SIP
Phone is via SIP.
Constant Value: 3 (0x00000003)
public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION
The subscription is not valid. It must be an active opportunistic subscription.
Constant Value: 2 (0x00000002)
public static final int SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE
The subscription is not valid. It must be an opportunistic subscription.
Constant Value: 3 (0x00000003)
public static final int SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION
Subscription service happened remote exception.
Constant Value: 4 (0x00000004)
public static final int SET_OPPORTUNISTIC_SUB_SUCCESS
No error. Operation succeeded.
Constant Value: 0 (0x00000000)
public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED
Validation failed when trying to switch to preferred subscription.
Constant Value: 1 (0x00000001)
public static final int SIM_STATE_ABSENT
SIM card state: no SIM card is available in the device
Constant Value: 1 (0x00000001)
public static final int SIM_STATE_CARD_IO_ERROR
SIM card state: SIM Card Error, present but faulty
Constant Value: 8 (0x00000008)
public static final int SIM_STATE_CARD_RESTRICTED
SIM card state: SIM Card restricted, present but not usable due to carrier restrictions.
Constant Value: 9 (0x00000009)
public static final int SIM_STATE_NETWORK_LOCKED
SIM card state: Locked: requires a network PIN to unlock
Constant Value: 4 (0x00000004)
public static final int SIM_STATE_NOT_READY
SIM card state: SIM Card is NOT READY
Constant Value: 6 (0x00000006)
public static final int SIM_STATE_PERM_DISABLED
SIM card state: SIM Card Error, permanently disabled
Constant Value: 7 (0x00000007)
public static final int SIM_STATE_PIN_REQUIRED
SIM card state: Locked: requires the user's SIM PIN to unlock
Constant Value: 2 (0x00000002)
public static final int SIM_STATE_PUK_REQUIRED
SIM card state: Locked: requires the user's SIM PUK to unlock
Constant Value: 3 (0x00000003)
public static final int SIM_STATE_READY
SIM card state: Ready
Constant Value: 5 (0x00000005)
public static final int SIM_STATE_UNKNOWN
SIM card state: Unknown. Signifies that the SIM is in transition between states. For example, when the user inputs the SIM pin under PIN_REQUIRED state, a query for sim status returns this state before turning to SIM_STATE_READY. These are the ordinal value of IccCardConstants.State.
Constant Value: 0 (0x00000000)
public static final int UNINITIALIZED_CARD_ID
A UICC card identifier used before the UICC card is loaded. See
getCardIdForDefaultEuicc()
and UiccCardInfo#getCardId()
.
Note that once the UICC card is loaded, the card ID may become UNSUPPORTED_CARD_ID
.
Constant Value: -2 (0xfffffffe)
public static final int UNKNOWN_CARRIER_ID
An unknown carrier id. It could either be subscription unavailable or the subscription
carrier cannot be recognized. Unrecognized carriers here means
MCC+MNC
cannot be identified.
Constant Value: -1 (0xffffffff)
public static final int UNSUPPORTED_CARD_ID
A UICC card identifier used if the device does not support the operation.
For example, getCardIdForDefaultEuicc()
returns this value if the device has no
eUICC, or the eUICC cannot be read.
Constant Value: -1 (0xffffffff)
public static final int UPDATE_AVAILABLE_NETWORKS_ABORTED
The request is aborted.
Constant Value: 2 (0x00000002)
public static final int UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL
Disable modem fail.
Constant Value: 5 (0x00000005)
public static final int UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL
Enable modem fail.
Constant Value: 6 (0x00000006)
public static final int UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS
The parameter passed in is invalid.
Constant Value: 3 (0x00000003)
public static final int UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED
Carrier app does not support multiple available networks.
Constant Value: 7 (0x00000007)
public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE
No carrier privilege.
Constant Value: 4 (0x00000004)
public static final int UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE
The subscription is not valid. It must be an opportunistic subscription.
Constant Value: 8 (0x00000008)
public static final int UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION
There is no OpportunisticNetworkService.
Constant Value: 9 (0x00000009)
public static final int UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED
OpportunisticNetworkService is disabled.
Constant Value: 10 (0x0000000a)
public static final int UPDATE_AVAILABLE_NETWORKS_SUCCESS
No error. Operation succeeded.
Constant Value: 0 (0x00000000)
public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE
There is a unknown failure happened.
Constant Value: 1 (0x00000001)
public static final int USSD_ERROR_SERVICE_UNAVAIL
Failure code returned when a USSD request has failed to execute because the Telephony service is unavailable.
Returned via TelephonyManager.UssdResponseCallback#onReceiveUssdResponseFailed(
TelephonyManager, String, int)
.
Constant Value: -2 (0xfffffffe)
public static final int USSD_RETURN_FAILURE
Failed code returned when the mobile network has failed to complete a USSD request.
Returned via TelephonyManager.UssdResponseCallback#onReceiveUssdResponseFailed(
TelephonyManager, String, int)
.
Constant Value: -1 (0xffffffff)
public static final String VVM_TYPE_CVVM
A flavor of OMTP protocol with a different mobile originated (MO) format
Constant Value: "vvm_type_cvvm"
public static final String VVM_TYPE_OMTP
The OMTP protocol.
Constant Value: "vvm_type_omtp"
public static final String EXTRA_STATE_IDLE
Value used with EXTRA_STATE
corresponding to
CALL_STATE_IDLE
.
public static final String EXTRA_STATE_OFFHOOK
Value used with EXTRA_STATE
corresponding to
CALL_STATE_OFFHOOK
.
public static final String EXTRA_STATE_RINGING
Value used with EXTRA_STATE
corresponding to
CALL_STATE_RINGING
.
public boolean canChangeDtmfToneLength ()
Whether the device supports configuring the DTMF tone length.
Returns | |
---|---|
boolean |
true if the DTMF tone length can be changed, and false otherwise. |
public TelephonyManager createForPhoneAccountHandle (PhoneAccountHandle phoneAccountHandle)
Create a new TelephonyManager object pinned to the subscription ID associated with the given phone account.
Parameters | |
---|---|
phoneAccountHandle |
PhoneAccountHandle |
Returns | |
---|---|
TelephonyManager |
a TelephonyManager that uses the given phone account for all calls, or null
if the phone account does not correspond to a valid subscription ID. |
public TelephonyManager createForSubscriptionId (int subId)
Create a new TelephonyManager object pinned to the given subscription ID.
Parameters | |
---|---|
subId |
int |
Returns | |
---|---|
TelephonyManager |
a TelephonyManager that uses the given subId for all calls. |
public boolean doesSwitchMultiSimConfigTriggerReboot ()
Get whether making changes to modem configurations by switchMultiSimConfig(int)
will
trigger device reboot.
The modem configuration change refers to switching from single SIM configuration to DSDS
or the other way around.
Requires Permission:
READ_PHONE_STATE
or that the
calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
boolean |
true if reboot will be triggered after making changes to modem
configurations, otherwise return false . |
public int getActiveModemCount ()
Returns the number of logical modems currently configured to be activated. Returns 0 if none of voice, sms, data is not supported Returns 1 for Single standby mode (Single SIM functionality). Returns 2 for Dual standby mode (Dual SIM functionality). Returns 3 for Tri standby mode (Tri SIM functionality).
Returns | |
---|---|
int |
public List<CellInfo> getAllCellInfo ()
Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells.
The response can include one or more CellInfoGsm
,
CellInfoCdma
,
CellInfoTdscdma
,
CellInfoLte
, and
CellInfoWcdma
objects, in any combination.
It is typical to see instances of one or more of any these in the list. In addition, zero
or more of the returned objects may be considered registered; that is, their
CellInfo.isRegistered()
methods may return true, indicating that the cell is being used or would be used for
signaling communication if necessary.
Beginning with Android Q
,
if this API results in a change of the cached CellInfo, that change will be reported via
onCellInfoChanged()
.
Apps targeting Android Q
or higher will no
longer trigger a refresh of the cached CellInfo by invoking this API. Instead, those apps
will receive the latest cached results, which may not be current. Apps targeting
Android Q
or higher that wish to request updated
CellInfo should call
requestCellInfoUpdate()
;
however, in all cases, updates will be rate-limited and are not guaranteed. To determine the
recency of CellInfo data, callers should check
CellInfo#getTimeStamp()
.
This method returns valid data for devices with
FEATURE_TELEPHONY
. In cases
where only partial information is available for a particular CellInfo entry, unavailable
fields will be reported as CellInfo.UNAVAILABLE
. All reported
cells will include at least a valid set of technology-specific identification info and a
power level measurement.
This method is preferred over using getCellLocation()
.
Requires Manifest.permission.ACCESS_FINE_LOCATION
Returns | |
---|---|
List<CellInfo> |
List of CellInfo ; null if cell
information is unavailable. |
public int getCallState ()
Returns the state of all calls on the device.
This method considers not only calls in the Telephony stack, but also calls via other
ConnectionService
implementations.
Note: The call state returned via this method may differ from what is reported by
PhoneStateListener#onCallStateChanged(int, String)
, as that callback only considers
Telephony (mobile) calls.
Returns | |
---|---|
int |
the current call state.
Value is CALL_STATE_IDLE , CALL_STATE_RINGING , or CALL_STATE_OFFHOOK |
public int getCardIdForDefaultEuicc ()
Get the card ID of the default eUICC card. If the eUICCs have not yet been loaded, returns
UNINITIALIZED_CARD_ID
. If there is no eUICC or the device does not support card IDs
for eUICCs, returns UNSUPPORTED_CARD_ID
.
The card ID is a unique identifier associated with a UICC or eUICC card. Card IDs are unique to a device, and always refer to the same UICC or eUICC card unless the device goes through a factory reset.
Returns | |
---|---|
int |
card ID of the default eUICC card, if loaded. |
public PersistableBundle getCarrierConfig ()
Returns the carrier config of the subscription ID pinned to the TelephonyManager. If an invalid subscription ID is pinned to the TelephonyManager, the returned config will contain default values.
This method may take several seconds to complete, so it should only be called from a worker thread.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
This method may take several seconds to complete, so it should
only be called from a worker thread.
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
PersistableBundle |
public int getCarrierIdFromSimMccMnc ()
Returns carrier id based on sim MCCMNC (returned by getSimOperator()
) only.
This is used for fallback when configurations/logic for exact carrier id
getSimCarrierId()
are not found.
Android carrier id table here
can be updated out-of-band, its possible a MVNO (Mobile Virtual Network Operator) carrier
was not fully recognized and assigned to its MNO (Mobile Network Operator) carrier id
by default. After carrier id table update, a new carrier id was assigned. If apps don't
take the update with the new id, it might be helpful to always fallback by using carrier
id based on MCCMNC if there is no match.
Returns | |
---|---|
int |
matching carrier id from sim MCCMNC. Return UNKNOWN_CARRIER_ID if the
subscription is unavailable or the carrier cannot be identified. |
public CellLocation getCellLocation ()
This method is deprecated.
use getAllCellInfo()
instead, which returns a superset of this API.
Returns the current location of the device.
If there is only one radio in the device and that radio has an LTE connection, this method will return null. The implementation must not to try add LTE identifiers into the existing cdma/gsm classes.
Requires Manifest.permission.ACCESS_FINE_LOCATION
Returns | |
---|---|
CellLocation |
Current location of the device or null if not available. |
public int getDataActivity ()
Returns a constant indicating the type of activity on a data connection (cellular).
Returns | |
---|---|
int |
public int getDataNetworkType ()
Returns a constant indicating the radio technology (network type)
currently in use on the device for data transmission.
If this object has been created with createForSubscriptionId(int)
, applies to the given
subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
See also:
NETWORK_TYPE_UNKNOWN
NETWORK_TYPE_GPRS
NETWORK_TYPE_EDGE
NETWORK_TYPE_UMTS
NETWORK_TYPE_HSDPA
NETWORK_TYPE_HSUPA
NETWORK_TYPE_HSPA
NETWORK_TYPE_CDMA
NETWORK_TYPE_EVDO_0
NETWORK_TYPE_EVDO_A
NETWORK_TYPE_EVDO_B
NETWORK_TYPE_1xRTT
NETWORK_TYPE_IDEN
NETWORK_TYPE_LTE
NETWORK_TYPE_EHRPD
NETWORK_TYPE_HSPAP
NETWORK_TYPE_NR
public int getDataState ()
Returns a constant indicating the current data connection state (cellular).
Returns | |
---|---|
int |
public String getDeviceId ()
This method is deprecated.
Use getImei()
which returns IMEI for GSM or getMeid()
which returns
MEID for CDMA.
Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones. Return null if device ID is not available.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
) on any
active subscription.
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Returns | |
---|---|
String |
public String getDeviceId (int slotIndex)
This method is deprecated.
Use getImei()
which returns IMEI for GSM or getMeid()
which returns
MEID for CDMA.
Returns the unique device ID of a subscription, for example, the IMEI for GSM and the MEID for CDMA phones. Return null if device ID is not available.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
) on any
active subscription.
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Parameters | |
---|---|
slotIndex |
int : of which deviceID is returned |
Returns | |
---|---|
String |
public String getDeviceSoftwareVersion ()
Returns the software version number for the device, for example, the IMEI/SV for GSM phones. Return null if the software version is not available.
Requires Permission: READ_PHONE_STATE
.
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
String |
public Map<Integer, List<EmergencyNumber>> getEmergencyNumberList ()
Get the emergency number list based on current locale, sim, default, modem and network.
In each returned list, the emergency number EmergencyNumber
coming from higher
priority sources will be located at the smaller index; the priority order of sources are:
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_SIM
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_DATABASE
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_DEFAULT
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG
The subscriptions which the returned list would be based on, are all the active subscriptions, no matter which subscription could be used to create TelephonyManager.
Requires permission Manifest.permission.READ_PHONE_STATE
or the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
Map<Integer, List<EmergencyNumber>> |
Map including the keys as the active subscription IDs (Note: if there is no active
subscription, the key is SubscriptionManager#getDefaultSubscriptionId ) and the value
as the list of EmergencyNumber ; empty Map if this information is not available;
or throw a SecurityException if the caller does not have the permission.
This value cannot be null . |
public Map<Integer, List<EmergencyNumber>> getEmergencyNumberList (int categories)
Get the per-category emergency number list based on current locale, sim, default, modem and network.
In each returned list, the emergency number EmergencyNumber
coming from higher
priority sources will be located at the smaller index; the priority order of sources are:
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_SIM
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_DATABASE
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_DEFAULT
>
EmergencyNumber#EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG
The subscriptions which the returned list would be based on, are all the active subscriptions, no matter which subscription could be used to create TelephonyManager.
Requires permission Manifest.permission.READ_PHONE_STATE
or the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
Map<Integer, List<EmergencyNumber>> |
Map including the keys as the active subscription IDs (Note: if there is no active
subscription, the key is SubscriptionManager#getDefaultSubscriptionId ) and the value
as the list of EmergencyNumber ; empty Map if this information is not available;
or throw a SecurityException if the caller does not have the permission.
This value cannot be null . |
Throws | |
---|---|
IllegalStateException |
if the Telephony process is not currently available. |
public String[] getForbiddenPlmns ()
Returns an array of Forbidden PLMNs from the USIM App Returns null if the query fails.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
String[] |
an array of forbidden PLMNs or null if not available |
public String getGroupIdLevel1 ()
Returns the Group Identifier Level1 for a GSM phone. Return null if it is unavailable.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
String |
public String getIccAuthentication (int appType, int authType, String data)
Returns the response of authentication for the default subscription. Returns null if the authentication hasn't been successful
Requires Permission: READ_PRIVILEGED_PHONE_STATE or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
appType |
int : the icc application type, like APPTYPE_USIM |
authType |
int : the authentication type, AUTHTYPE_EAP_AKA or
AUTHTYPE_EAP_SIM |
data |
String : authentication challenge data, base64 encoded.
See 3GPP TS 31.102 7.1.2 for more details. |
Returns | |
---|---|
String |
the response of authentication. This value will be null in the following cases: Authentication error, incorrect MAC Authentication error, security context not supported Key freshness failure Authentication error, no memory space available Authentication error, no memory space available in EFMUK |
public String getImei (int slotIndex)
Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not available.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
) on any
active subscription.
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Parameters | |
---|---|
slotIndex |
int : of which IMEI is returned |
Returns | |
---|---|
String |
public String getImei ()
Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not
available.
See getImei(int)
for details on the required permissions and behavior
when the caller does not hold sufficient permissions.
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Returns | |
---|---|
String |
public String getLine1Number ()
Returns the phone number string for line 1, for example, the MSISDN for a GSM phone for a particular subscription. Return null if it is unavailable.
The default SMS app can also use this.
Requires Permission:
READ_SMS
,
READ_PHONE_NUMBERS
,
that the caller is the default SMS app,
or that the caller has carrier privileges (see hasCarrierPrivileges()
)
for any API level.
READ_PHONE_STATE
for apps targeting SDK API level 29 and below.
Requires Manifest.permission.READ_PHONE_STATE
or Manifest.permission.READ_SMS
or Manifest.permission.READ_PHONE_NUMBERS
Returns | |
---|---|
String |
public String getManualNetworkSelectionPlmn ()
Get the PLMN chosen for Manual Network Selection if active. Return empty string if in automatic selection.
Requires Permission: READ_PRECISE_PHONE_STATE
or that the calling app has carrier privileges
(see hasCarrierPrivileges()
)
Requires Manifest.permission.READ_PRECISE_PHONE_STATE
Returns | |
---|---|
String |
manually selected network info on success or empty string on failure
This value cannot be null . |
public String getManufacturerCode (int slotIndex)
Returns the Manufacturer Code from the MEID. Return null if Manufacturer Code is not available.
Parameters | |
---|---|
slotIndex |
int : of which Type Allocation Code is returned |
Returns | |
---|---|
String |
public String getManufacturerCode ()
Returns the Manufacturer Code from the MEID. Return null if Manufacturer Code is not available.
Returns | |
---|---|
String |
public String getMeid ()
Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
) on any
active subscription.
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Returns | |
---|---|
String |
public String getMeid (int slotIndex)
Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
) on any
active subscription.
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Parameters | |
---|---|
slotIndex |
int : of which MEID is returned |
Returns | |
---|---|
String |
public String getMmsUAProfUrl ()
Returns the MMS user agent profile URL.
Returns | |
---|---|
String |
public String getNai ()
Returns the Network Access Identifier (NAI). Return null if NAI is not available.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
).
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Returns | |
---|---|
String |
public String getNetworkCountryIso ()
Returns the ISO-3166-1 alpha-2 country code equivalent of the MCC (Mobile Country Code) of
the current registered operator or the cell nearby, if available.
Note: Result may be unreliable on CDMA networks (use getPhoneType()
to determine
if on a CDMA network).
Returns | |
---|---|
String |
the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string if not available. |
public String getNetworkCountryIso (int slotIndex)
Returns the ISO-3166-1 alpha-2 country code equivalent of the MCC (Mobile Country Code) of
the current registered operator or the cell nearby, if available. This is same as
getNetworkCountryIso()
but allowing specifying the SIM slot index. This is used for
accessing network country info from the SIM slot that does not have SIM inserted.
Note: Result may be unreliable on CDMA networks (use getPhoneType()
to determine
if on a CDMA network).
Parameters | |
---|---|
slotIndex |
int : the SIM slot index to get network country ISO. |
Returns | |
---|---|
String |
the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string if not
available.
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
when the slotIndex is invalid. |
public String getNetworkOperator ()
Returns the numeric name (MCC+MNC) of current registered operator.
Availability: Only when user is registered to a network. Result may be
unreliable on CDMA networks (use getPhoneType()
to determine if
on a CDMA network).
Returns | |
---|---|
String |
public String getNetworkOperatorName ()
Returns the alphabetic name of current registered operator.
Availability: Only when user is registered to a network. Result may be
unreliable on CDMA networks (use getPhoneType()
to determine if
on a CDMA network).
Returns | |
---|---|
String |
public int getNetworkSelectionMode ()
Get the network selection mode.
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
Requires Permission: READ_PRECISE_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE or Manifest.permission.READ_PRECISE_PHONE_STATE
Returns | |
---|---|
int |
the network selection mode.
Value is NETWORK_SELECTION_MODE_UNKNOWN , NETWORK_SELECTION_MODE_AUTO , or NETWORK_SELECTION_MODE_MANUAL |
public String getNetworkSpecifier ()
Returns the network specifier of the subscription ID pinned to the TelephonyManager. The
network specifier is used by NetworkRequest.Builder.setNetworkSpecifier(String)
to create a NetworkRequest
that connects through the subscription.
Returns | |
---|---|
String |
public int getNetworkType ()
This method is deprecated.
use getDataNetworkType()
Return the current data network type.
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
int |
the NETWORK_TYPE_xxxx for current data connection.
Value is NETWORK_TYPE_UNKNOWN , NETWORK_TYPE_GPRS , NETWORK_TYPE_EDGE , NETWORK_TYPE_UMTS , NETWORK_TYPE_CDMA , NETWORK_TYPE_EVDO_0 , NETWORK_TYPE_EVDO_A , NETWORK_TYPE_1xRTT , NETWORK_TYPE_HSDPA , NETWORK_TYPE_HSUPA , NETWORK_TYPE_HSPA , NETWORK_TYPE_IDEN , NETWORK_TYPE_EVDO_B , NETWORK_TYPE_LTE , NETWORK_TYPE_EHRPD , NETWORK_TYPE_HSPAP , NETWORK_TYPE_GSM , NETWORK_TYPE_TD_SCDMA , NETWORK_TYPE_IWLAN , or NETWORK_TYPE_NR |
public int getPhoneCount ()
This method is deprecated.
Use getActiveModemCount()
instead.
Returns the number of phones available. Returns 0 if none of voice, sms, data is not supported Returns 1 for Single standby mode (Single SIM functionality). Returns 2 for Dual standby mode (Dual SIM functionality). Returns 3 for Tri standby mode (Tri SIM functionality).
Returns | |
---|---|
int |
public int getPhoneType ()
Returns a constant indicating the device phone type. This indicates the type of radio used to transmit voice calls.
Returns | |
---|---|
int |
public int getPreferredOpportunisticDataSubscription ()
Get preferred opportunistic data subscription Id
Requires that the calling app has carrier privileges (see hasCarrierPrivileges()
),
or has either READ_PRIVILEGED_PHONE_STATE
or READ_PHONE_STATE
permission.
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE or Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
int |
subId preferred opportunistic subscription id or
SubscriptionManager#DEFAULT_SUBSCRIPTION_ID if there are no preferred
subscription id |
public ServiceState getServiceState ()
Returns the current ServiceState
information.
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
)
and Manifest.permission.ACCESS_COARSE_LOCATION
.
Requires Manifest.permission.READ_PHONE_STATE
and Manifest.permission.ACCESS_COARSE_LOCATION
Returns | |
---|---|
ServiceState |
public SignalStrength getSignalStrength ()
Get the most recently available signal strength information. Get the most recent SignalStrength information reported by the modem. Due to power saving this information may not always be current.
Returns | |
---|---|
SignalStrength |
the most recent cached signal strength info from the modem
This value may be null . |
public int getSimCarrierId ()
Returns carrier id of the current subscription.
To recognize a carrier (including MVNO) as a first-class identity, Android assigns each carrier with a canonical integer a.k.a. carrier id. The carrier ID is an Android platform-wide identifier for a carrier. AOSP maintains carrier ID assignments in here
Apps which have carrier-specific configurations or business logic can use the carrier id as an Android platform-wide identifier for carriers.
Returns | |
---|---|
int |
Carrier id of the current subscription. Return UNKNOWN_CARRIER_ID if the
subscription is unavailable or the carrier cannot be identified. |
public CharSequence getSimCarrierIdName ()
Returns carrier id name of the current subscription.
Carrier id name is a user-facing name of carrier id returned by
getSimCarrierId()
, usually the brand name of the subsidiary
(e.g. T-Mobile). Each carrier could configure multiple SPN
but
should have a single carrier name. Carrier name is not a canonical identity,
use getSimCarrierId()
instead.
The returned carrier name is unlocalized.
Returns | |
---|---|
CharSequence |
Carrier name of the current subscription. Return null if the subscription is
unavailable or the carrier cannot be identified. |
public String getSimCountryIso ()
Returns the ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.
The ISO-3166-1 alpha-2 country code is provided in lowercase 2 character format.
Returns | |
---|---|
String |
the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string is not available. |
public String getSimOperator ()
Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM. 5 or 6 decimal digits.
Availability: SIM state must be SIM_STATE_READY
Returns | |
---|---|
String |
See also:
public String getSimOperatorName ()
Returns the Service Provider Name (SPN).
Availability: SIM state must be SIM_STATE_READY
Returns | |
---|---|
String |
See also:
public String getSimSerialNumber ()
Returns the serial number of the SIM, if applicable. Return null if it is unavailable.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
).
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Returns | |
---|---|
String |
public int getSimSpecificCarrierId ()
Returns fine-grained carrier ID of the current subscription.
A specific carrier ID can represent the fact that a carrier may be in effect an aggregation
of other carriers (ie in an MVNO type scenario) where each of these specific carriers which
are used to make up the actual carrier service may have different carrier configurations.
A specific carrier ID could also be used, for example, in a scenario where a carrier requires
different carrier configuration for different service offering such as a prepaid plan.
the specific carrier ID would be used for configuration purposes, but apps wishing to know
about the carrier itself should use the regular carrier ID returned by
getSimCarrierId()
.
e.g, Tracfone SIMs could return different specific carrier ID based on IMSI from current
subscription while carrier ID remains the same.
For carriers without fine-grained specific carrier ids, return getSimCarrierId()
Specific carrier ids are defined in the same way as carrier id here except each with a "parent" id linking to its top-level carrier id.
Returns | |
---|---|
int |
Returns fine-grained carrier id of the current subscription.
Return UNKNOWN_CARRIER_ID if the subscription is unavailable or the carrier cannot
be identified. |
public CharSequence getSimSpecificCarrierIdName ()
Similar like getSimCarrierIdName()
, returns user-facing name of the
specific carrier id returned by getSimSpecificCarrierId()
.
The specific carrier ID would be used for configuration purposes, but apps wishing to know
about the carrier itself should use the regular carrier ID returned by
getSimCarrierIdName()
.
The returned name is unlocalized.
Returns | |
---|---|
CharSequence |
user-facing name of the subscription specific carrier id. Return null if the
subscription is unavailable or the carrier cannot be identified. |
public int getSimState ()
Returns a constant indicating the state of the default SIM card.
Returns | |
---|---|
int |
Value is SIM_STATE_UNKNOWN , SIM_STATE_ABSENT , SIM_STATE_PIN_REQUIRED , SIM_STATE_PUK_REQUIRED , SIM_STATE_NETWORK_LOCKED , SIM_STATE_READY , SIM_STATE_NOT_READY , SIM_STATE_PERM_DISABLED , SIM_STATE_CARD_IO_ERROR , SIM_STATE_CARD_RESTRICTED , android.telephony.TelephonyManager.SIM_STATE_LOADED, or android.telephony.TelephonyManager.SIM_STATE_PRESENT |
public int getSimState (int slotIndex)
Returns a constant indicating the state of the device SIM card in a logical slot.
Parameters | |
---|---|
slotIndex |
int : logical slot index |
Returns | |
---|---|
int |
Value is SIM_STATE_UNKNOWN , SIM_STATE_ABSENT , SIM_STATE_PIN_REQUIRED , SIM_STATE_PUK_REQUIRED , SIM_STATE_NETWORK_LOCKED , SIM_STATE_READY , SIM_STATE_NOT_READY , SIM_STATE_PERM_DISABLED , SIM_STATE_CARD_IO_ERROR , SIM_STATE_CARD_RESTRICTED , android.telephony.TelephonyManager.SIM_STATE_LOADED, or android.telephony.TelephonyManager.SIM_STATE_PRESENT |
public String getSubscriberId ()
Returns the unique subscriber ID, for example, the IMSI for a GSM phone. Return null if it is unavailable.
Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:
Manifest.permission#READ_PHONE_STATE
permission. The profile owner is an app that
owns a managed profile on the device; for more details see Work profiles.
Profile owner access is deprecated and will be removed in a future release.
hasCarrierPrivileges()
).
RoleManager#isRoleHeld(String)
).
If the calling app does not meet one of these requirements then this method will behave as follows:
Returns | |
---|---|
String |
public int getSubscriptionId (PhoneAccountHandle phoneAccountHandle)
Returns the subscription ID for the given phone account handle.
Requires Manifest.permission.READ_PHONE_STATE
Parameters | |
---|---|
phoneAccountHandle |
PhoneAccountHandle : the phone account handle for outgoing calls
This value cannot be null . |
Returns | |
---|---|
int |
subscription ID for the given phone account handle; or
SubscriptionManager#INVALID_SUBSCRIPTION_ID
if not available; or throw a SecurityException if the caller doesn't have the
permission. |
public int getSubscriptionId ()
Return an appropriate subscription ID for any situation.
If this object has been created with createForSubscriptionId(int)
, then the provided
subscription ID is returned. Otherwise, the default subscription ID will be returned.
Returns | |
---|---|
int |
public int getSupportedModemCount ()
Return how many logical modem can be potentially active simultaneously, in terms of hardware
capability.
It might return different value from getActiveModemCount()
. For example, for a
dual-SIM capable device operating in single SIM mode (only one logical modem is turned on),
getActiveModemCount()
returns 1 while this API returns 2.
Returns | |
---|---|
int |
public String getTypeAllocationCode ()
Returns the Type Allocation Code from the IMEI. Return null if Type Allocation Code is not available.
Returns | |
---|---|
String |
public String getTypeAllocationCode (int slotIndex)
Returns the Type Allocation Code from the IMEI. Return null if Type Allocation Code is not available.
Parameters | |
---|---|
slotIndex |
int : of which Type Allocation Code is returned |
Returns | |
---|---|
String |
public List<UiccCardInfo> getUiccCardsInfo ()
Gets information about currently inserted UICCs and eUICCs.
Requires that the calling app has carrier privileges (see hasCarrierPrivileges()
).
If the caller has carrier priviliges on any active subscription, then they have permission to
get simple information like the card ID (UiccCardInfo#getCardId()
), whether the card
is an eUICC (UiccCardInfo#isEuicc()
), and the slot index where the card is inserted
(UiccCardInfo#getSlotIndex()
).
To get private information such as the EID (UiccCardInfo#getEid()
) or ICCID
(UiccCardInfo#getIccId()
), the caller must have carrier priviliges on that specific
UICC or eUICC card.
See UiccCardInfo
for more details on the kind of information available.
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Returns | |
---|---|
List<UiccCardInfo> |
a list of UiccCardInfo objects, representing information on the currently inserted
UICCs and eUICCs. Each UiccCardInfo in the list will have private information filtered out if
the caller does not have adequate permissions for that card.
This value cannot be null . |
public String getVisualVoicemailPackageName ()
Returns the package responsible of processing visual voicemail for the subscription ID pinned
to the TelephonyManager. Returns null
when there is no package responsible for
processing visual voicemail for the subscription.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
String |
public String getVoiceMailAlphaTag ()
Retrieves the alphabetic identifier associated with the voice mail number.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
String |
public String getVoiceMailNumber ()
Returns the voice mail number. Return null if it is unavailable.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
String |
public int getVoiceNetworkType ()
Returns the NETWORK_TYPE_xxxx for voice
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
public Uri getVoicemailRingtoneUri (PhoneAccountHandle accountHandle)
Returns the URI for the per-account voicemail ringtone set in Phone settings.
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : The handle for the PhoneAccount for which to retrieve the
voicemail ringtone. |
Returns | |
---|---|
Uri |
The URI for the ringtone to play when receiving a voicemail from a specific PhoneAccount. |
public boolean hasCarrierPrivileges ()
Has the calling application been granted carrier privileges by the carrier. If any of the packages in the calling UID has carrier privileges, the call will return true. This access is granted by the owner of the UICC card and does not depend on the registered carrier. Note that this API applies to both physical and embedded subscriptions and is a superset of the checks done in SubscriptionManager#canManageSubscription.
Returns | |
---|---|
boolean |
true if the app has carrier privileges. |
public boolean hasIccCard ()
Returns | |
---|---|
boolean |
true if a ICC card is present |
public boolean iccCloseLogicalChannel (int channel)
This method is deprecated.
Use SEService
APIs instead. See
Channel.close()
.
Closes a previously opened logical channel to the ICC card. Input parameters equivalent to TS 27.007 AT+CCHC command.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
channel |
int : is the channel id to be closed as returned by a successful
iccOpenLogicalChannel. |
Returns | |
---|---|
boolean |
true if the channel was closed successfully. |
public byte[] iccExchangeSimIO (int fileID, int command, int p1, int p2, int p3, String filePath)
This method is deprecated.
Use SEService
APIs instead. See
SEService.getUiccReader(int)
,
Reader.openSession()
,
Session.openBasicChannel(byte[], byte)
,
Channel.transmit(byte[])
.
Returns the response APDU for a command APDU sent through SIM_IO.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
p1 |
int : P1 value of the APDU command. |
p2 |
int : P2 value of the APDU command. |
p3 |
int : P3 value of the APDU command. |
Returns | |
---|---|
byte[] |
The APDU response. |
public IccOpenLogicalChannelResponse iccOpenLogicalChannel (String AID, int p2)
This method is deprecated.
Use SEService
APIs instead. See
SEService.getUiccReader(int)
,
Reader.openSession()
,
Session.openLogicalChannel(byte[], byte)
.
Opens a logical channel to the ICC card. This operation wraps two APDU instructions:
AID
using the given p2
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
AID |
String : Application id. See ETSI 102.221 and 101.220. |
p2 |
int : P2 parameter (described in ISO 7816-4). |
Returns | |
---|---|
IccOpenLogicalChannelResponse |
an IccOpenLogicalChannelResponse object. |
public IccOpenLogicalChannelResponse iccOpenLogicalChannel (String AID)
This method is deprecated.
Replaced by iccOpenLogicalChannel(java.lang.String, int)
Opens a logical channel to the ICC card. Input parameters equivalent to TS 27.007 AT+CCHO command.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
AID |
String : Application id. See ETSI 102.221 and 101.220. |
Returns | |
---|---|
IccOpenLogicalChannelResponse |
an IccOpenLogicalChannelResponse object. |
public String iccTransmitApduBasicChannel (int cla, int instruction, int p1, int p2, int p3, String data)
This method is deprecated.
Use SEService
APIs instead. See
SEService.getUiccReader(int)
,
Reader.openSession()
,
Session.openBasicChannel(byte[], byte)
,
Channel.transmit(byte[])
.
Transmit an APDU to the ICC card over the basic channel. Input parameters equivalent to TS 27.007 AT+CSIM command.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
cla |
int : Class of the APDU command. |
instruction |
int : Instruction of the APDU command. |
p1 |
int : P1 value of the APDU command. |
p2 |
int : P2 value of the APDU command. |
p3 |
int : P3 value of the APDU command. If p3 is negative a 4 byte APDU
is sent to the SIM. |
data |
String : Data to be sent with the APDU. |
Returns | |
---|---|
String |
The APDU response from the ICC card with the status appended at the end. |
public String iccTransmitApduLogicalChannel (int channel, int cla, int instruction, int p1, int p2, int p3, String data)
This method is deprecated.
Use SEService
APIs instead. See
Channel.transmit(byte[])
.
Transmit an APDU to the ICC card over a logical channel. Input parameters equivalent to TS 27.007 AT+CGLA command.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
channel |
int : is the channel id to be closed as returned by a successful
iccOpenLogicalChannel. |
cla |
int : Class of the APDU command. |
instruction |
int : Instruction of the APDU command. |
p1 |
int : P1 value of the APDU command. |
p2 |
int : P2 value of the APDU command. |
p3 |
int : P3 value of the APDU command. If p3 is negative a 4 byte APDU
is sent to the SIM. |
data |
String : Data to be sent with the APDU. |
Returns | |
---|---|
String |
The APDU response from the ICC card with the status appended at the end. |
public boolean isConcurrentVoiceAndDataSupported ()
Whether the device is currently on a technology (e.g. UMTS or LTE) which can support voice and data simultaneously. This can change based on location or network condition.
Returns | |
---|---|
boolean |
true if simultaneous voice and data supported, and false otherwise. |
public boolean isDataEnabled ()
Returns whether mobile data is enabled or not per user setting. There are other factors
that could disable mobile data, but they are not considered here.
If this object has been created with createForSubscriptionId(int)
, applies to the given
subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()
Requires one of the following permissions:
Manifest.permission.ACCESS_NETWORK_STATE
,
Manifest.permission.MODIFY_PHONE_STATE
, or that the calling app has carrier
privileges (see hasCarrierPrivileges()
).
Note that this does not take into account any data restrictions that may be present on the
calling app. Such restrictions may be inspected with
ConnectivityManager#getRestrictBackgroundStatus
.
Requires Manifest.permission.ACCESS_NETWORK_STATE
or Manifest.permission.MODIFY_PHONE_STATE
Returns | |
---|---|
boolean |
true if mobile data is enabled. |
public boolean isDataRoamingEnabled ()
Returns whether mobile data roaming is enabled on the subscription.
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()
Requires one of the following permissions:
Manifest.permission.ACCESS_NETWORK_STATE
,
Manifest.permission.READ_PHONE_STATE
or that the calling app
has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.ACCESS_NETWORK_STATE
or Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
boolean |
true if the data roaming is enabled on the subscription, otherwise return
false . |
public boolean isEmergencyNumber (String number)
Identifies if the supplied phone number is an emergency number that matches a known emergency number based on current locale, SIM card(s), Android database, modem, network, or defaults.
This method assumes that only dialable phone numbers are passed in; non-dialable
numbers are not considered emergency numbers. A dialable phone number consists only
of characters/digits identified by PhoneNumberUtils#isDialable(char)
.
The subscriptions which the identification would be based on, are all the active subscriptions, no matter which subscription could be used to create TelephonyManager.
Parameters | |
---|---|
number |
String : - the number to look up
This value cannot be null . |
Returns | |
---|---|
boolean |
true if the given number is an emergency number based on current locale,
SIM card(s), Android database, modem, network or defaults; false otherwise. |
Throws | |
---|---|
IllegalStateException |
if the Telephony process is not currently available. |
public boolean isHearingAidCompatibilitySupported ()
Whether the phone supports hearing aid compatibility.
Returns | |
---|---|
boolean |
true if the device supports hearing aid compatibility, and false
otherwise. |
public boolean isManualNetworkSelectionAllowed ()
Checks if manual network selection is allowed.
Requires Permission: READ_PRECISE_PHONE_STATE
or that the calling app has carrier privileges
(see hasCarrierPrivileges()
)
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
.
Requires Manifest.permission.READ_PRECISE_PHONE_STATE
or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Returns | |
---|---|
boolean |
true if manual network selection is allowed, otherwise return false . |
public boolean isModemEnabledForSlot (int slotIndex)
It indicates whether modem is enabled or not per slot. It's the corresponding status of TelephonyManager.enableModemForSlot.
Requires Permission:
READ_PRIVILEGED_PHONE_STATE or
READ_PHONE_STATE
Requires Manifest.permission.READ_PHONE_STATE
Parameters | |
---|---|
slotIndex |
int : which slot it's checking. |
Returns | |
---|---|
boolean |
public int isMultiSimSupported ()
Returns if the usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported by the device and by the carrier.
Requires Permission: READ_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.READ_PHONE_STATE
Returns | |
---|---|
int |
MULTISIM_ALLOWED if the device supports multiple SIMs.
MULTISIM_NOT_SUPPORTED_BY_HARDWARE if the device does not support multiple SIMs.
MULTISIM_NOT_SUPPORTED_BY_CARRIER in the device supports multiple SIMs, but the
functionality is restricted by the carrier.
Value is MULTISIM_ALLOWED , MULTISIM_NOT_SUPPORTED_BY_HARDWARE , or MULTISIM_NOT_SUPPORTED_BY_CARRIER |
public boolean isNetworkRoaming ()
Returns true if the device is considered roaming on the current network, for GSM purposes.
Availability: Only when user registered to a network.
Returns | |
---|---|
boolean |
public boolean isRttSupported ()
Determines whether the device currently supports RTT (Real-time text). Based both on carrier support for the feature and device firmware support.
Returns | |
---|---|
boolean |
true if the device and carrier both support RTT, false otherwise. |
public boolean isSmsCapable ()
Returns | |
---|---|
boolean |
true if the current device supports sms service.
If true, this means that the device supports both sending and receiving sms via the telephony network. Note: Voicemail waiting sms, cell broadcasting sms, and MMS are disabled when device doesn't support sms. |
public boolean isTtyModeSupported ()
This method is deprecated.
Use TelecomManager#isTtySupported()
instead
Whether the phone supports TTY mode.
Returns | |
---|---|
boolean |
true if the device supports TTY mode, and false otherwise. |
public boolean isVoiceCapable ()
Returns | |
---|---|
boolean |
true if the current device is "voice capable".
"Voice capable" means that this device supports circuit-switched (i.e. voice) phone calls over the telephony network, and is allowed to display the in-call UI while a cellular voice call is active. This will be false on "data only" devices which can't make voice calls and don't support any in-call UI. Note: the meaning of this flag is subtly different from the PackageManager.FEATURE_TELEPHONY system feature, which is available on any device with a telephony radio, even if the device is data-only. |
public boolean isVoicemailVibrationEnabled (PhoneAccountHandle accountHandle)
Returns whether vibration is set for voicemail notification in Phone settings.
Parameters | |
---|---|
accountHandle |
PhoneAccountHandle : The handle for the PhoneAccount for which to retrieve the
voicemail vibration setting. |
Returns | |
---|---|
boolean |
true if the vibration is set for this PhoneAccount, false otherwise. |
public boolean isWorldPhone ()
Whether the device is a world phone.
Returns | |
---|---|
boolean |
true if the device is a world phone, and false otherwise. |
public void listen (PhoneStateListener listener, int events)
Registers a listener object to receive notification of changes in specified telephony states.
To register a listener, pass a PhoneStateListener
and specify at least one telephony
state of interest in the events argument.
At registration, and when a specified telephony state changes, the telephony manager invokes
the appropriate callback method on the listener object and passes the current (updated)
values.
To un-register a listener, pass the listener object and set the events argument to
PhoneStateListener#LISTEN_NONE
(0).
If this TelephonyManager object has been created with createForSubscriptionId(int)
,
applies to the given subId. Otherwise, applies to
SubscriptionManager#getDefaultSubscriptionId()
. To listen events for multiple subIds,
pass a separate listener object to each TelephonyManager object created with
createForSubscriptionId(int)
.
Note: if you call this method while in the middle of a binder transaction, you must
call Binder.clearCallingIdentity()
before calling this method. A
SecurityException
will be thrown otherwise.
This API should be used sparingly -- large numbers of listeners will cause system
instability. If a process has registered too many listeners without unregistering them, it
may encounter an IllegalStateException
when trying to register more listeners.
Parameters | |
---|---|
listener |
PhoneStateListener : The PhoneStateListener object to register
(or unregister) |
events |
int : The telephony state(s) of interest to the listener,
as a bitwise-OR combination of PhoneStateListener
LISTEN_ flags. |
public void requestCellInfoUpdate (Executor executor, TelephonyManager.CellInfoCallback callback)
Requests all available cell information from the current subscription for observed camped/registered, serving, and neighboring cells.
Any available results from this request will be provided by calls to
onCellInfoChanged()
for each active subscription.
This method returns valid data for devices with
FEATURE_TELEPHONY
. On devices
that do not implement this feature, the behavior is not reliable.
Requires Manifest.permission.ACCESS_FINE_LOCATION
Parameters | |
---|---|
executor |
Executor : the executor on which callback will be invoked.
This value cannot be null .
Callback and listener events are dispatched through this
Executor , providing an easy way to control which thread is
used. To dispatch events through the main thread of your
application, you can use
Context.getMainExecutor() .
To dispatch events through a shared thread pool, you can use
AsyncTask#THREAD_POOL_EXECUTOR . |
callback |
TelephonyManager.CellInfoCallback : a callback to receive CellInfo.
This value cannot be null . |
public NetworkScan requestNetworkScan (NetworkScanRequest request, Executor executor, TelephonyScanManager.NetworkScanCallback callback)
Request a network scan. This method is asynchronous, so the network scan results will be returned by callback. The returned NetworkScan will contain a callback method which can be used to stop the scan.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
)
and Manifest.permission.ACCESS_FINE_LOCATION
.
If the system-wide location switch is off, apps may still call this API, with the
following constraints:
android.permission.NETWORK_SCAN
permission.Manifest.permission.MODIFY_PHONE_STATE
and Manifest.permission.ACCESS_FINE_LOCATION
Parameters | |
---|---|
request |
NetworkScanRequest : Contains all the RAT with bands/channels that need to be scanned. |
executor |
Executor : The executor through which the callback should be invoked. Since the scan
request may trigger multiple callbacks and they must be invoked in the same order as
they are received by the platform, the user should provide an executor which executes
tasks one at a time in serial order. For example AsyncTask.SERIAL_EXECUTOR. |
callback |
TelephonyScanManager.NetworkScanCallback : Returns network scan results or errors. |
Returns | |
---|---|
NetworkScan |
A NetworkScan obj which contains a callback which can be used to stop the scan. |
public void sendDialerSpecialCode (String inputCode)
Send the special dialer code. The IPC caller must be the current default dialer or have
carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
inputCode |
String : The special dialer code to send |
Throws | |
---|---|
SecurityException |
if the caller does not have carrier privileges or is not the current default dialer |
public String sendEnvelopeWithStatus (String content)
This method is deprecated.
Use SEService
APIs instead. See
SEService.getUiccReader(int)
,
Reader.openSession()
,
Session.openBasicChannel(byte[], byte)
,
Channel.transmit(byte[])
.
Send ENVELOPE to the SIM and return the response.
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
content |
String : String containing SAT/USAT response in hexadecimal
format starting with command tag. See TS 102 223 for
details. |
Returns | |
---|---|
String |
The APDU response from the ICC card in hexadecimal format with the last 4 bytes being the status word. If the command fails, returns an empty string. |
public void sendUssdRequest (String ussdRequest, TelephonyManager.UssdResponseCallback callback, Handler handler)
Sends an Unstructured Supplementary Service Data (USSD) request to the mobile network and
informs the caller of the response via the supplied callback
.
Carriers define USSD codes which can be sent by the user to request information such as the user's current data balance or minutes balance.
Requires permission:
Manifest.permission.CALL_PHONE
Requires Manifest.permission.CALL_PHONE
Parameters | |
---|---|
ussdRequest |
String : the USSD command to be executed. |
callback |
TelephonyManager.UssdResponseCallback : called by the framework to inform the caller of the result of executing the
USSD request (see UssdResponseCallback ). |
handler |
Handler : the Handler to run the request on. |
public void sendVisualVoicemailSms (String number, int port, String text, PendingIntent sentIntent)
Send a visual voicemail SMS. The caller must be the current default dialer.
A VisualVoicemailService
uses this method to send a command via SMS to the carrier's
visual voicemail server. Some examples for carriers using the OMTP standard include
activating and deactivating visual voicemail, or requesting the current visual voicemail
provisioning status. See the OMTP Visual Voicemail specification for more information on the
format of these SMS messages.
Requires Permission:
SEND_SMS
Parameters | |
---|---|
number |
String : The destination number. |
port |
int : The destination port for data SMS, or 0 for text SMS. |
text |
String : The message content. For data sms, it will be encoded as a UTF-8 byte stream. |
sentIntent |
PendingIntent : The sent intent passed to the SmsManager |
Throws | |
---|---|
SecurityException |
if the caller is not the current default dialer |
public void setDataEnabled (boolean enable)
Turns mobile data on or off.
If this object has been created with createForSubscriptionId(int)
, applies to the given
subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
enable |
boolean : Whether to enable mobile data. |
public int setForbiddenPlmns (List<String> fplmns)
Replace the contents of the forbidden PLMN SIM file with the provided values. Passing an empty list will clear the contents of the EFfplmn file. If the provided list is shorter than the size of EFfplmn, then the list will be padded up to the file size with 'FFFFFF'. (required by 3GPP TS 31.102 spec 4.2.16) If the list is longer than the size of EFfplmn, then the file will be written from the beginning of the list up to the file size.
Requires Permission: MODIFY_PHONE_STATE
or that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
fplmns |
List : a list of PLMNs to be forbidden.
This value cannot be null . |
Returns | |
---|---|
int |
number of PLMNs that were successfully written to the SIM FPLMN list. This may be less than the number of PLMNs passed in where the SIM file does not have enough room for all of the values passed in. Return -1 in the event of an unexpected failure |
public boolean setLine1NumberForDisplay (String alphaTag, String number)
Set the line 1 phone number string and its alphatag for the current ICCID for display purpose only, for example, displayed in Phone Status. It won't change the actual MSISDN/MDN. To unset alphatag or number, pass in a null value.
Requires that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
alphaTag |
String : alpha-tagging of the dailing nubmer |
number |
String : The dialing number |
Returns | |
---|---|
boolean |
true if the operation was executed correctly. |
public void setNetworkSelectionModeAutomatic ()
Sets the network selection mode to automatic.
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.MODIFY_PHONE_STATE
public boolean setNetworkSelectionModeManual (String operatorNumeric, boolean persistSelection, int ran)
Ask the radio to connect to the input network and change selection mode to manual.
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
operatorNumeric |
String : the PLMN ID of the network to select.
This value cannot be null . |
persistSelection |
boolean : whether the selection will persist until reboot.
If true, only allows attaching to the selected PLMN until reboot; otherwise,
attach to the chosen PLMN and resume normal network selection next time. |
ran |
int : the initial suggested radio access network type.
If registration fails, the RAN is not available after, the RAN is not within the
network types specified by the preferred network types, or the value is
AccessNetworkConstants.AccessNetworkType#UNKNOWN , modem will select
the next best RAN for network registration.
Value is AccessNetworkConstants.AccessNetworkType.UNKNOWN , AccessNetworkConstants.AccessNetworkType.GERAN , AccessNetworkConstants.AccessNetworkType.UTRAN , AccessNetworkConstants.AccessNetworkType.EUTRAN , AccessNetworkConstants.AccessNetworkType.CDMA2000 , AccessNetworkConstants.AccessNetworkType.IWLAN , or AccessNetworkConstants.AccessNetworkType.NGRAN |
Returns | |
---|---|
boolean |
true on success; false on any failure. |
public boolean setNetworkSelectionModeManual (String operatorNumeric, boolean persistSelection)
Ask the radio to connect to the input network and change selection mode to manual.
If this object has been created with createForSubscriptionId(int)
, applies to the
given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
Requires Permission:
MODIFY_PHONE_STATE
or that the calling
app has carrier privileges (see hasCarrierPrivileges()
).
Requires Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
operatorNumeric |
String : the PLMN ID of the network to select. |
persistSelection |
boolean : whether the selection will persist until reboot. If true, only allows
attaching to the selected PLMN until reboot; otherwise, attach to the chosen PLMN and resume
normal network selection next time. |
Returns | |
---|---|
boolean |
true on success; false on any failure. |
public boolean setOperatorBrandOverride (String brand)
Override the branding for the current ICCID. Once set, whenever the SIM is present in the device, the service provider name (SPN) and the operator name will both be replaced by the brand value input. To unset the value, the same function should be called with a null brand value.
Requires that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
brand |
String : The brand name to display/set. |
Returns | |
---|---|
boolean |
true if the operation was executed correctly. |
public boolean setPreferredNetworkTypeToGlobal ()
Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
Requires that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Returns | |
---|---|
boolean |
true on success; false on any failure. |
public void setPreferredOpportunisticDataSubscription (int subId, boolean needValidation, Executor executor, Consumer<Integer> callback)
Set preferred opportunistic data subscription id. Switch internet data to preferred opportunistic data subscription id. This api can result in lose of internet connectivity for short period of time while internet data is handed over.
Requires that the calling app has carrier privileges on both primary and
secondary subscriptions (see
hasCarrierPrivileges()
), or has permission
MODIFY_PHONE_STATE
.
Parameters | |
---|---|
subId |
int : which opportunistic subscription
SubscriptionManager#getOpportunisticSubscriptions is preferred for cellular data.
Pass SubscriptionManager#DEFAULT_SUBSCRIPTION_ID to unset the preference |
needValidation |
boolean : whether validation is needed before switch happens. |
executor |
Executor : The executor of where the callback will execute.
This value may be null .
Callback and listener events are dispatched through this
Executor , providing an easy way to control which thread is
used. To dispatch events through the main thread of your
application, you can use
Context.getMainExecutor() .
To dispatch events through a shared thread pool, you can use
AsyncTask#THREAD_POOL_EXECUTOR . |
callback |
Consumer : Callback will be triggered once it succeeds or failed.
See TelephonyManager.SetOpportunisticSubscriptionResult
for more details. Pass null if don't care about the result.
This value may be null . |
public void setVisualVoicemailSmsFilterSettings (VisualVoicemailSmsFilterSettings settings)
Set the visual voicemail SMS filter settings for the subscription ID pinned
to the TelephonyManager.
When the filter is enabled, VisualVoicemailService#onSmsReceived(VisualVoicemailTask, VisualVoicemailSms)
will be
called when a SMS matching the settings is received. Caller must be the default dialer,
system dialer, or carrier visual voicemail app.
Parameters | |
---|---|
settings |
VisualVoicemailSmsFilterSettings : The settings for the filter, or null to disable the filter. |
public boolean setVoiceMailNumber (String alphaTag, String number)
Sets the voice mail number.
Requires that the calling app has carrier privileges (see hasCarrierPrivileges()
).
Parameters | |
---|---|
alphaTag |
String : The alpha tag to display. |
number |
String : The voicemail number. |
Returns | |
---|---|
boolean |
public void setVoicemailRingtoneUri (PhoneAccountHandle phoneAccountHandle, Uri uri)
This method is deprecated.
Use Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS
instead.
Sets the per-account voicemail ringtone.
Requires that the calling app is the default dialer, or has carrier privileges (see
hasCarrierPrivileges()
, or has permission
MODIFY_PHONE_STATE
.
Parameters | |
---|---|
phoneAccountHandle |
PhoneAccountHandle : The handle for the PhoneAccount for which to set the
voicemail ringtone. |
uri |
Uri : The URI for the ringtone to play when receiving a voicemail from a specific
PhoneAccount. |
public void setVoicemailVibrationEnabled (PhoneAccountHandle phoneAccountHandle, boolean enabled)
This method is deprecated.
Use Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS
instead.
Sets the per-account preference whether vibration is enabled for voicemail notifications.
Requires that the calling app is the default dialer, or has carrier privileges (see
hasCarrierPrivileges()
, or has permission
MODIFY_PHONE_STATE
.
Parameters | |
---|---|
phoneAccountHandle |
PhoneAccountHandle : The handle for the PhoneAccount for which to set the
voicemail vibration setting. |
enabled |
boolean : Whether to enable or disable vibration for voicemail notifications from a
specific PhoneAccount. |
public void switchMultiSimConfig (int numOfSims)
Switch configs to enable multi-sim or switch back to single-sim
Requires Permission:
MODIFY_PHONE_STATE
or that the
calling app has carrier privileges (see hasCarrierPrivileges()
).
Note: with only carrier privileges, it is not allowed to switch from multi-sim
to single-sim
Requires Manifest.permission.MODIFY_PHONE_STATE
Parameters | |
---|---|
numOfSims |
int : number of live SIMs we want to switch to |
Throws | |
---|---|
|
android.os.RemoteException |
public void updateAvailableNetworks (List<AvailableNetworkInfo> availableNetworks, Executor executor, Consumer<Integer> callback)
Update availability of a list of networks in the current location.
This api should be called to inform OpportunisticNetwork Service about the availability
of a network at the current location. This information will be used by OpportunisticNetwork
service to enable modem stack and to attach to the network. If an empty list is passed,
it is assumed that no network is available and will result in disabling the modem stack
to save power. This api do not switch internet data once network attach is completed.
Use TelephonyManager#setPreferredOpportunisticDataSubscription
to switch internet data after network attach is complete.
Requires that the calling app has carrier privileges on both primary and
secondary subscriptions (see hasCarrierPrivileges()
), or has permission
MODIFY_PHONE_STATE
.
Parameters | |
---|---|
availableNetworks |
List : is a list of available network information.
This value cannot be null . |
executor |
Executor : The executor of where the callback will execute.
This value may be null .
Callback and listener events are dispatched through this
Executor , providing an easy way to control which thread is
used. To dispatch events through the main thread of your
application, you can use
Context.getMainExecutor() .
To dispatch events through a shared thread pool, you can use
AsyncTask#THREAD_POOL_EXECUTOR . |
callback |
Consumer : Callback will be triggered once it succeeds or failed.
Value is UPDATE_AVAILABLE_NETWORKS_SUCCESS , UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE , UPDATE_AVAILABLE_NETWORKS_ABORTED , UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS , UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE , UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL , UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL , UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED , UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE , UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION , or UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED
This value may be null . |