TelephonyManager

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.

Instances of this class must be obtained using Context.getSystemService(Class) with the argument TelephonyManager.class or Context.getSystemService(String) with the argument Context.TELEPHONY_SERVICE.

Summary

Nested classes

class TelephonyManager.UssdResponseCallback

Used to notify callers of TelephonyManager.sendUssdRequest(String, UssdResponseCallback, Handler) when the network either successfully executes a USSD request, or if there was a failure while executing the request. 

Constants

String ACTION_CONFIGURE_VOICEMAIL

Open the voicemail settings activity to make changes to voicemail configuration.

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_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.

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 CarrierConfigManager.KEY_CDMA_ROAMING_MODE_INT which permits roaming on affiliated networks.

int CDMA_ROAMING_MODE_ANY

Value for CarrierConfigManager.KEY_CDMA_ROAMING_MODE_INT which permits roaming on any network.

int CDMA_ROAMING_MODE_HOME

Value for CarrierConfigManager.KEY_CDMA_ROAMING_MODE_INT which only permits connections on home networks.

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.

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_SUSPENDED

Data connection state: Suspended.

String EXTRA_CALL_VOICEMAIL_INTENT

The intent to call voicemail.

String EXTRA_CARRIER_ID

An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED which indicates the updated carrier id getSimCarrierId() of the current subscription.

String EXTRA_CARRIER_NAME

An string extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED which indicates the updated carrier name of the current subscription.

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.

String EXTRA_INCOMING_NUMBER

Extra key used with the ACTION_PHONE_STATE_CHANGED broadcast for a String containing the incoming or outgoing phone number.

String EXTRA_IS_REFRESH

Boolean value representing whether the ACTION_SHOW_VOICEMAIL_NOTIFICATION is new or a refresh of an existing notification.

String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT

The intent to launch voicemail settings.

String EXTRA_NOTIFICATION_COUNT

The number of voice messages associated with the notification.

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.

String EXTRA_STATE

The lookup key used with the ACTION_PHONE_STATE_CHANGED broadcast for a String containing the new call state.

String EXTRA_SUBSCRIPTION_ID

An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED to indicate the subscription which has changed.

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 TelecomManager.ACTION_SHOW_CALL_SETTINGS.

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_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 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 UNKNOWN_CARRIER_ID

An unknown carrier id.

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 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 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.

List<CellInfo> getAllCellInfo()

Returns all observed cell information from all radios on the device including the primary and neighboring cells.

int getCallState()

Returns one of the following constants that represents the current state of all phone calls.

PersistableBundle getCarrierConfig()

Returns the carrier config of the subscription ID pinned to the TelephonyManager.

CellLocation getCellLocation()

This method was deprecated in API level 26. use getAllCellInfo() instead, which returns a superset of this API.

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 was deprecated in API level 26. Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns MEID for CDMA.

String getDeviceId(int slotIndex)

This method was deprecated in API level 26. Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns MEID for CDMA.

String getDeviceSoftwareVersion()

Returns the software version number for the device, for example, the IMEI/SV for GSM phones.

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.

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

List<NeighboringCellInfo> getNeighboringCellInfo()

This method was deprecated in API level 23. Use getAllCellInfo() which returns a superset of the information from NeighboringCellInfo.

String getNetworkCountryIso()

Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current registered operator, or nearby cell information if not registered.

String getNetworkOperator()

Returns the numeric name (MCC+MNC) of current registered operator.

String getNetworkOperatorName()

Returns the alphabetic name of current registered operator.

String getNetworkSpecifier()

Returns the network specifier of the subscription ID pinned to the TelephonyManager.

int getNetworkType()
int getPhoneCount()

Returns the number of phones available.

int getPhoneType()

Returns a constant indicating the device phone type.

ServiceState getServiceState()

Returns the current ServiceState information.

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 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 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 slot.

String getSubscriberId()

Returns the unique subscriber ID, for example, the IMSI for a GSM phone.

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: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

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)

Closes a previously opened logical channel to the ICC card.

byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3, String filePath)

Returns the response APDU for a command APDU sent through SIM_IO.

IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID)

This method was deprecated in API level 26. Replaced by iccOpenLogicalChannel(String, int)

IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID, int p2)

Opens a logical channel to the ICC card.

String iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2, int p3, String data)

Transmit an APDU to the ICC card over the basic channel.

String iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2, int p3, String data)

Transmit an APDU to the ICC card over a logical channel.

boolean isConcurrentVoiceAndDataSupported()

Whether the device is currently on a technology (e.g.

boolean isDataEnabled()

Returns whether mobile data is enabled or not per user setting.

boolean isHearingAidCompatibilitySupported()

Whether the phone supports hearing aid compatibility.

boolean isNetworkRoaming()

Returns true if the device is considered roaming on the current network, for GSM purposes.

boolean isSmsCapable()
boolean isTtyModeSupported()

This method was deprecated in API level 28. Use TelecomManager.isTtySupported() instead Whether the phone supports TTY mode.

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.

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)

Send ENVELOPE to the SIM and return the response.

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.

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.

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)

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 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 was deprecated in API level 28. Use Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS instead.

void setVoicemailVibrationEnabled(PhoneAccountHandle phoneAccountHandle, boolean enabled)

This method was deprecated in API level 28. Use Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS instead.

Inherited methods

Constants

ACTION_CONFIGURE_VOICEMAIL

added in API level 23
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"

ACTION_PHONE_STATE_CHANGED

added in API level 3
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 the READ_PHONE_STATE permission.

Constant Value: "android.intent.action.PHONE_STATE"

ACTION_RESPOND_VIA_MESSAGE

added in API level 18
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"

ACTION_SHOW_VOICEMAIL_NOTIFICATION

added in API level 26
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.

Constant Value: "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION"

ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED

added in API level 28
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:

  • Subscription absent. Carrier identity could change from a valid id to UNKNOWN_CARRIER_ID.
  • Subscription loaded. Carrier identity could change from UNKNOWN_CARRIER_ID to a valid id.
  • The subscription carrier is recognized after a remote update.
The intent will have the following extra values:

This is a protected intent that can only be sent by the system.

Constant Value: "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED"

APPTYPE_CSIM

added in API level 24
public static final int APPTYPE_CSIM

UICC application type is CSIM

Constant Value: 4 (0x00000004)

APPTYPE_ISIM

added in API level 24
public static final int APPTYPE_ISIM

UICC application type is ISIM

Constant Value: 5 (0x00000005)

APPTYPE_RUIM

added in API level 24
public static final int APPTYPE_RUIM

UICC application type is RUIM

Constant Value: 3 (0x00000003)

APPTYPE_SIM

added in API level 24
public static final int APPTYPE_SIM

UICC application type is SIM

Constant Value: 1 (0x00000001)

APPTYPE_USIM

added in API level 24
public static final int APPTYPE_USIM

UICC application type is USIM

Constant Value: 2 (0x00000002)

AUTHTYPE_EAP_AKA

added in API level 24
public static final int AUTHTYPE_EAP_AKA

Authentication type for UICC challenge is EAP AKA. See RFC 4187 for details.

Constant Value: 129 (0x00000081)

AUTHTYPE_EAP_SIM

added in API level 24
public static final int AUTHTYPE_EAP_SIM

Authentication type for UICC challenge is EAP SIM. See RFC 4186 for details.

Constant Value: 128 (0x00000080)

CALL_STATE_IDLE

added in API level 1
public static final int CALL_STATE_IDLE

Device call state: No activity.

Constant Value: 0 (0x00000000)

CALL_STATE_OFFHOOK

added in API level 1
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)

CALL_STATE_RINGING

added in API level 1
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)

CDMA_ROAMING_MODE_AFFILIATED

added in API level 28
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)

CDMA_ROAMING_MODE_ANY

added in API level 28
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)

CDMA_ROAMING_MODE_HOME

added in API level 28
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)

CDMA_ROAMING_MODE_RADIO_DEFAULT

added in API level 28
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)

DATA_ACTIVITY_DORMANT

added in API level 4
public static final int DATA_ACTIVITY_DORMANT

Data connection is active, but physical link is down

Constant Value: 4 (0x00000004)

DATA_ACTIVITY_IN

added in API level 1
public static final int DATA_ACTIVITY_IN

Data connection activity: Currently receiving IP PPP traffic.

Constant Value: 1 (0x00000001)

DATA_ACTIVITY_INOUT

added in API level 1
public static final int DATA_ACTIVITY_INOUT

Data connection activity: Currently both sending and receiving IP PPP traffic.

Constant Value: 3 (0x00000003)

DATA_ACTIVITY_NONE

added in API level 1
public static final int DATA_ACTIVITY_NONE

Data connection activity: No traffic.

Constant Value: 0 (0x00000000)

DATA_ACTIVITY_OUT

added in API level 1
public static final int DATA_ACTIVITY_OUT

Data connection activity: Currently sending IP PPP traffic.

Constant Value: 2 (0x00000002)

DATA_CONNECTED

added in API level 1
public static final int DATA_CONNECTED

Data connection state: Connected. IP traffic should be available.

Constant Value: 2 (0x00000002)

DATA_CONNECTING

added in API level 1
public static final int DATA_CONNECTING

Data connection state: Currently setting up a data connection.

Constant Value: 1 (0x00000001)

DATA_DISCONNECTED

added in API level 1
public static final int DATA_DISCONNECTED

Data connection state: Disconnected. IP traffic not available.

Constant Value: 0 (0x00000000)

DATA_SUSPENDED

added in API level 1
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)

EXTRA_CALL_VOICEMAIL_INTENT

added in API level 26
public static final String EXTRA_CALL_VOICEMAIL_INTENT

The intent to call voicemail.

Constant Value: "android.telephony.extra.CALL_VOICEMAIL_INTENT"

EXTRA_CARRIER_ID

added in API level 28
public static final String EXTRA_CARRIER_ID

An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED which indicates the updated carrier id getSimCarrierId() of the current subscription.

Will be UNKNOWN_CARRIER_ID if the subscription is unavailable or the carrier cannot be identified.

Constant Value: "android.telephony.extra.CARRIER_ID"

EXTRA_CARRIER_NAME

added in API level 28
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.

Carrier name is a user-facing name of the carrier id EXTRA_CARRIER_ID, usually the brand name of the subsidiary (e.g. T-Mobile).

Constant Value: "android.telephony.extra.CARRIER_NAME"

EXTRA_HIDE_PUBLIC_SETTINGS

added in API level 26
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"

EXTRA_INCOMING_NUMBER

added in API level 3
public static final String EXTRA_INCOMING_NUMBER

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"

EXTRA_IS_REFRESH

added in API level 27
public static final String EXTRA_IS_REFRESH

Boolean value representing whether the 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"

EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT

added in API level 26
public static final String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT

The intent to launch voicemail settings.

Constant Value: "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT"

EXTRA_NOTIFICATION_COUNT

added in API level 26
public static final String EXTRA_NOTIFICATION_COUNT

The number of voice messages associated with the notification.

Constant Value: "android.telephony.extra.NOTIFICATION_COUNT"

EXTRA_PHONE_ACCOUNT_HANDLE

added in API level 26
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"

EXTRA_STATE

added in API level 3
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"

EXTRA_SUBSCRIPTION_ID

added in API level 28
public static final String EXTRA_SUBSCRIPTION_ID

An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED to indicate the subscription which has changed.

Constant Value: "android.telephony.extra.SUBSCRIPTION_ID"

EXTRA_VOICEMAIL_NUMBER

added in API level 26
public static final String EXTRA_VOICEMAIL_NUMBER

The voicemail number.

Constant Value: "android.telephony.extra.VOICEMAIL_NUMBER"

METADATA_HIDE_VOICEMAIL_SETTINGS_MENU

added in API level 26
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.

Constant Value: "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU"

NETWORK_TYPE_1xRTT

added in API level 4
public static final int NETWORK_TYPE_1xRTT

Current network is 1xRTT

Constant Value: 7 (0x00000007)

NETWORK_TYPE_CDMA

added in API level 4
public static final int NETWORK_TYPE_CDMA

Current network is CDMA: Either IS95A or IS95B

Constant Value: 4 (0x00000004)

NETWORK_TYPE_EDGE

added in API level 1
public static final int NETWORK_TYPE_EDGE

Current network is EDGE

Constant Value: 2 (0x00000002)

NETWORK_TYPE_EHRPD

added in API level 11
public static final int NETWORK_TYPE_EHRPD

Current network is eHRPD

Constant Value: 14 (0x0000000e)

NETWORK_TYPE_EVDO_0

added in API level 4
public static final int NETWORK_TYPE_EVDO_0

Current network is EVDO revision 0

Constant Value: 5 (0x00000005)

NETWORK_TYPE_EVDO_A

added in API level 4
public static final int NETWORK_TYPE_EVDO_A

Current network is EVDO revision A

Constant Value: 6 (0x00000006)

NETWORK_TYPE_EVDO_B

added in API level 9
public static final int NETWORK_TYPE_EVDO_B

Current network is EVDO revision B

Constant Value: 12 (0x0000000c)

NETWORK_TYPE_GPRS

added in API level 1
public static final int NETWORK_TYPE_GPRS

Current network is GPRS

Constant Value: 1 (0x00000001)

NETWORK_TYPE_GSM

added in API level 25
public static final int NETWORK_TYPE_GSM

Current network is GSM

Constant Value: 16 (0x00000010)

NETWORK_TYPE_HSDPA

added in API level 5
public static final int NETWORK_TYPE_HSDPA

Current network is HSDPA

Constant Value: 8 (0x00000008)

NETWORK_TYPE_HSPA

added in API level 5
public static final int NETWORK_TYPE_HSPA

Current network is HSPA

Constant Value: 10 (0x0000000a)

NETWORK_TYPE_HSPAP

added in API level 13
public static final int NETWORK_TYPE_HSPAP

Current network is HSPA+

Constant Value: 15 (0x0000000f)

NETWORK_TYPE_HSUPA

added in API level 5
public static final int NETWORK_TYPE_HSUPA

Current network is HSUPA

Constant Value: 9 (0x00000009)

NETWORK_TYPE_IDEN

added in API level 8
public static final int NETWORK_TYPE_IDEN

Current network is iDen

Constant Value: 11 (0x0000000b)

NETWORK_TYPE_IWLAN

added in API level 25
public static final int NETWORK_TYPE_IWLAN

Current network is IWLAN

Constant Value: 18 (0x00000012)

NETWORK_TYPE_LTE

added in API level 11
public static final int NETWORK_TYPE_LTE

Current network is LTE

Constant Value: 13 (0x0000000d)

NETWORK_TYPE_TD_SCDMA

added in API level 25
public static final int NETWORK_TYPE_TD_SCDMA

Current network is TD_SCDMA

Constant Value: 17 (0x00000011)

NETWORK_TYPE_UMTS

added in API level 1
public static final int NETWORK_TYPE_UMTS

Current network is UMTS

Constant Value: 3 (0x00000003)

NETWORK_TYPE_UNKNOWN

added in API level 1
public static final int NETWORK_TYPE_UNKNOWN

Network type is unknown

Constant Value: 0 (0x00000000)

PHONE_TYPE_CDMA

added in API level 4
public static final int PHONE_TYPE_CDMA

Phone radio is CDMA.

Constant Value: 2 (0x00000002)

PHONE_TYPE_GSM

added in API level 1
public static final int PHONE_TYPE_GSM

Phone radio is GSM.

Constant Value: 1 (0x00000001)

PHONE_TYPE_NONE

added in API level 1
public static final int PHONE_TYPE_NONE

No phone radio.

Constant Value: 0 (0x00000000)

PHONE_TYPE_SIP

added in API level 11
public static final int PHONE_TYPE_SIP

Phone is via SIP.

Constant Value: 3 (0x00000003)

SIM_STATE_ABSENT

added in API level 1
public static final int SIM_STATE_ABSENT

SIM card state: no SIM card is available in the device

Constant Value: 1 (0x00000001)

SIM_STATE_CARD_IO_ERROR

added in API level 26
public static final int SIM_STATE_CARD_IO_ERROR

SIM card state: SIM Card Error, present but faulty

Constant Value: 8 (0x00000008)

SIM_STATE_CARD_RESTRICTED

added in API level 26
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)

SIM_STATE_NETWORK_LOCKED

added in API level 1
public static final int SIM_STATE_NETWORK_LOCKED

SIM card state: Locked: requires a network PIN to unlock

Constant Value: 4 (0x00000004)

SIM_STATE_NOT_READY

added in API level 26
public static final int SIM_STATE_NOT_READY

SIM card state: SIM Card is NOT READY

Constant Value: 6 (0x00000006)

SIM_STATE_PERM_DISABLED

added in API level 26
public static final int SIM_STATE_PERM_DISABLED

SIM card state: SIM Card Error, permanently disabled

Constant Value: 7 (0x00000007)

SIM_STATE_PIN_REQUIRED

added in API level 1
public static final int SIM_STATE_PIN_REQUIRED

SIM card state: Locked: requires the user's SIM PIN to unlock

Constant Value: 2 (0x00000002)

SIM_STATE_PUK_REQUIRED

added in API level 1
public static final int SIM_STATE_PUK_REQUIRED

SIM card state: Locked: requires the user's SIM PUK to unlock

Constant Value: 3 (0x00000003)

SIM_STATE_READY

added in API level 1
public static final int SIM_STATE_READY

SIM card state: Ready

Constant Value: 5 (0x00000005)

SIM_STATE_UNKNOWN

added in API level 1
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)

UNKNOWN_CARRIER_ID

added in API level 28
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)

USSD_ERROR_SERVICE_UNAVAIL

added in API level 26
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)

USSD_RETURN_FAILURE

added in API level 26
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)

VVM_TYPE_CVVM

added in API level 23
public static final String VVM_TYPE_CVVM

A flavor of OMTP protocol with a different mobile originated (MO) format

Constant Value: "vvm_type_cvvm"

VVM_TYPE_OMTP

added in API level 23
public static final String VVM_TYPE_OMTP

The OMTP protocol.

Constant Value: "vvm_type_omtp"

Fields

EXTRA_STATE_IDLE

added in API level 3
public static final String EXTRA_STATE_IDLE

Value used with EXTRA_STATE corresponding to CALL_STATE_IDLE.

EXTRA_STATE_OFFHOOK

added in API level 3
public static final String EXTRA_STATE_OFFHOOK

Value used with EXTRA_STATE corresponding to CALL_STATE_OFFHOOK.

EXTRA_STATE_RINGING

added in API level 3
public static final String EXTRA_STATE_RINGING

Value used with EXTRA_STATE corresponding to CALL_STATE_RINGING.

Public methods

canChangeDtmfToneLength

added in API level 23
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.

createForPhoneAccountHandle

added in API level 26
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.

createForSubscriptionId

added in API level 24
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.

getAllCellInfo

added in API level 17
public List<CellInfo> getAllCellInfo ()

Returns all observed cell information from all radios on the device including the primary and neighboring cells. Calling this method does not trigger a call to onCellInfoChanged(), or change the rate at which onCellInfoChanged() is called.

The list can include one or more CellInfoGsm, CellInfoCdma, CellInfoLte, and CellInfoWcdma objects, in any combination. On devices with multiple radios it is typical to see instances of one or more of any these in the list. In addition, zero, one, or more of the returned objects may be considered registered; that is, their CellInfo.isRegistered() methods may return true.

This method returns valid data for registered cells on devices with PackageManager.FEATURE_TELEPHONY. In cases where only partial information is available for a particular CellInfo entry, unavailable fields will be reported as Integer.MAX_VALUE. 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(). However, for older devices, getAllCellInfo() may return null. In these cases, you should call getCellLocation() instead.

Requires the ACCESS_COARSE_LOCATION permission.

Returns
List<CellInfo> List of CellInfo; null if cell information is unavailable.

getCallState

added in API level 1
public int getCallState ()

Returns one of the following constants that represents the current state of all phone calls. CALL_STATE_RINGING CALL_STATE_OFFHOOK CALL_STATE_IDLE

Returns
int

getCarrierConfig

added in API level 26
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()).

Returns
PersistableBundle

getCellLocation

added in API level 1
public CellLocation getCellLocation ()

This method was deprecated in API level 26.
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 the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions.

Returns
CellLocation Current location of the device or null if not available.

getDataActivity

added in API level 1
public int getDataActivity ()

Returns a constant indicating the type of activity on a data connection (cellular).

Returns
int

getDataNetworkType

added in API level 24
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()).

Returns
int the network type

getDataState

added in API level 1
public int getDataState ()

Returns a constant indicating the current data connection state (cellular).

Returns
int

getDeviceId

added in API level 1
public String getDeviceId ()

This method was deprecated in API level 26.
Use (@link getImei} which returns IMEI for GSM or (@link 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.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getDeviceId

added in API level 23
public String getDeviceId (int slotIndex)

This method was deprecated in API level 26.
Use (@link getImei} which returns IMEI for GSM or (@link 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.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Parameters
slotIndex int: of which deviceID is returned

Returns
String

getDeviceSoftwareVersion

added in API level 1
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 or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getForbiddenPlmns

added in API level 26
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()).

Returns
String[] an array of forbidden PLMNs or null if not available

getGroupIdLevel1

added in API level 18
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()).

Returns
String

getIccAuthentication

added in API level 24
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

getImei

added in API level 26
public String getImei (int slotIndex)

Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not available.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Parameters
slotIndex int: of which IMEI is returned

Returns
String

getImei

added in API level 26
public String getImei ()

Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not available.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getLine1Number

added in API level 1
public String getLine1Number ()

Returns the phone number string for line 1, for example, the MSISDN for a GSM phone. Return null if it is unavailable.

Requires Permission: READ_PHONE_STATE, READ_SMS, READ_PHONE_NUMBERS, that the caller is the default SMS app, or that the caller has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getMeid

added in API level 26
public String getMeid ()

Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getMeid

added in API level 26
public String getMeid (int slotIndex)

Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Parameters
slotIndex int: of which MEID is returned

Returns
String

getMmsUAProfUrl

added in API level 19
public String getMmsUAProfUrl ()

Returns the MMS user agent profile URL.

Returns
String

getMmsUserAgent

added in API level 19
public String getMmsUserAgent ()

Returns the MMS user agent.

Returns
String

getNai

added in API level 28
public String getNai ()

Returns the Network Access Identifier (NAI). Return null if NAI is not available.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getNeighboringCellInfo

added in API level 3
public List<NeighboringCellInfo> getNeighboringCellInfo ()

This method was deprecated in API level 23.
Use getAllCellInfo() which returns a superset of the information from NeighboringCellInfo.

Returns the neighboring cell information of the device.

Requires the ACCESS_COARSE_LOCATION permission.

Returns
List<NeighboringCellInfo> List of NeighboringCellInfo or null if info unavailable.

getNetworkCountryIso

added in API level 1
public String getNetworkCountryIso ()

Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current registered operator, or nearby cell information if not registered. .

Note: Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).

Returns
String

getNetworkOperator

added in API level 1
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

getNetworkOperatorName

added in API level 1
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

getNetworkSpecifier

added in API level 26
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

getNetworkType

added in API level 1
public int getNetworkType ()

Returns
int the NETWORK_TYPE_xxxx for current data connection.

getPhoneCount

added in API level 23
public int getPhoneCount ()

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
int

getPhoneType

added in API level 1
public int getPhoneType ()

Returns a constant indicating the device phone type. This indicates the type of radio used to transmit voice calls.

Returns
int

getServiceState

added in API level 26
public ServiceState getServiceState ()

Returns the current ServiceState information.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
ServiceState

getSignalStrength

added in API level 28
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.

getSimCarrierId

added in API level 28
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.

getSimCarrierIdName

added in API level 28
public CharSequence getSimCarrierIdName ()

Returns carrier id name of the current subscription.

Carrier id name is a user-facing name of carrier id 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.

getSimCountryIso

added in API level 1
public String getSimCountryIso ()

Returns the ISO country code equivalent for the SIM provider's country code.

Returns
String

getSimOperator

added in API level 1
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:

getSimOperatorName

added in API level 1
public String getSimOperatorName ()

Returns the Service Provider Name (SPN).

Availability: SIM state must be SIM_STATE_READY

Returns
String

See also:

getSimSerialNumber

added in API level 1
public String getSimSerialNumber ()

Returns the serial number of the SIM, if applicable. Return null if it is unavailable.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

Returns
String

getSimState

added in API level 26
public int getSimState (int slotIndex)

Returns a constant indicating the state of the device SIM card in a slot.

Returns
int

getSubscriberId

added in API level 1
public String getSubscriberId ()

Returns the unique subscriber ID, for example, the IMSI 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()).

Returns
String

getVisualVoicemailPackageName

added in API level 26
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()).

Returns
String

getVoiceMailAlphaTag

added in API level 1
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()).

Returns
String

getVoiceMailNumber

added in API level 1
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()).

Returns
String

getVoiceNetworkType

added in API level 24
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()).

Returns
int

getVoicemailRingtoneUri

added in API level 24
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.

hasCarrierPrivileges

added in API level 22
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.

Returns
boolean true if the app has carrier privileges.

hasIccCard

added in API level 5
public boolean hasIccCard ()

Returns
boolean true if a ICC card is present

iccCloseLogicalChannel

added in API level 21
public boolean iccCloseLogicalChannel (int channel)

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 retruned by a successful iccOpenLogicalChannel.

Returns
boolean true if the channel was closed successfully.

iccExchangeSimIO

added in API level 21
public byte[] iccExchangeSimIO (int fileID, 
                int command, 
                int p1, 
                int p2, 
                int p3, 
                String filePath)

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.

iccOpenLogicalChannel

added in API level 21
public IccOpenLogicalChannelResponse iccOpenLogicalChannel (String AID)

This method was deprecated in API level 26.
Replaced by iccOpenLogicalChannel(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.

iccOpenLogicalChannel

added in API level 26
public IccOpenLogicalChannelResponse iccOpenLogicalChannel (String AID, 
                int p2)

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.

p2 int: P2 parameter (described in ISO 7816-4).

Returns
IccOpenLogicalChannelResponse an IccOpenLogicalChannelResponse object.

iccTransmitApduBasicChannel

added in API level 21
public String iccTransmitApduBasicChannel (int cla, 
                int instruction, 
                int p1, 
                int p2, 
                int p3, 
                String data)

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.

iccTransmitApduLogicalChannel

added in API level 21
public String iccTransmitApduLogicalChannel (int channel, 
                int cla, 
                int instruction, 
                int p1, 
                int p2, 
                int p3, 
                String data)

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.

isConcurrentVoiceAndDataSupported

added in API level 26
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.

isDataEnabled

added in API level 26
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: ACCESS_NETWORK_STATE, 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().

Returns
boolean true if mobile data is enabled.

isHearingAidCompatibilitySupported

added in API level 23
public boolean isHearingAidCompatibilitySupported ()

Whether the phone supports hearing aid compatibility.

Returns
boolean true if the device supports hearing aid compatibility, and false otherwise.

isNetworkRoaming

added in API level 1
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

isSmsCapable

added in API level 21
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.

isTtyModeSupported

added in API level 23
public boolean isTtyModeSupported ()

This method was deprecated in API level 28.
Use TelecomManager.isTtySupported() instead Whether the phone supports TTY mode.

Returns
boolean true if the device supports TTY mode, and false otherwise.

isVoiceCapable

added in API level 22
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.

isVoicemailVibrationEnabled

added in API level 24
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.

isWorldPhone

added in API level 23
public boolean isWorldPhone ()

Whether the device is a world phone.

Returns
boolean true if the device is a world phone, and false otherwise.

listen

added in API level 1
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 unregister a listener, pass the listener object and set the events argument to LISTEN_NONE (0). 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.

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.

requestNetworkScan

added in API level 28
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()).

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.

sendDialerSpecialCode

added in API level 26
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

sendEnvelopeWithStatus

added in API level 21
public String sendEnvelopeWithStatus (String content)

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.

sendUssdRequest

added in API level 26
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 the CALL_PHONE permission.

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 TelephonyManager.UssdResponseCallback).

handler Handler: the Handler to run the request on.

sendVisualVoicemailSms

added in API level 26
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

setDataEnabled

added in API level 26
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()).

Parameters
enable boolean: Whether to enable mobile data.

setLine1NumberForDisplay

added in API level 22
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.

setNetworkSelectionModeAutomatic

added in API level 28
public void setNetworkSelectionModeAutomatic ()

Sets the network selection mode to automatic.

Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

setNetworkSelectionModeManual

added in API level 28
public boolean setNetworkSelectionModeManual (String operatorNumeric, 
                boolean persistSelection)

Ask the radio to connect to the input network and change selection mode to manual.

Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).

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.

setOperatorBrandOverride

added in API level 22
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.

setPreferredNetworkTypeToGlobal

added in API level 22
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.

setVisualVoicemailSmsFilterSettings

added in API level 26
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.

setVoiceMailNumber

added in API level 22
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

setVoicemailRingtoneUri

added in API level 26
public void setVoicemailRingtoneUri (PhoneAccountHandle phoneAccountHandle, 
                Uri uri)

This method was deprecated in API level 28.
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.

setVoicemailVibrationEnabled

added in API level 26
public void setVoicemailVibrationEnabled (PhoneAccountHandle phoneAccountHandle, 
                boolean enabled)

This method was deprecated in API level 28.
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.