Added in API level 1

TelephonyManager


open class TelephonyManager
kotlin.Any
   ↳ 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.
Requires the PackageManager#FEATURE_TELEPHONY feature which can be detected using PackageManager.hasSystemFeature(String).

Summary

Nested classes
open

Exception that may be supplied to the callback in #uploadCallComposerPicture if something goes awry.

abstract

Callback for providing asynchronous CellInfo on request

open

Exception that is supplied to the callback in getNetworkSlicingConfiguration if the modem returned a failure.

open

Exception that may be supplied to the callback in getNetworkSlicingConfiguration if something goes awry.

open

Exception that is supplied to the callback in getNetworkSlicingConfiguration if the system timed out waiting for a response from the Radio.

abstract

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
static String

A service action that identifies a android.service.carrier.CarrierMessagingClientService subclass in the AndroidManifest.

static String

Broadcast action sent when the availability of the system default network changes.

static String

Broadcast action sent when a PCO value becomes available from the modem.

static String

Broadcast action sent when a data connection is redirected with validation failure.

static String

Broadcast action sent when a data connection setup fails.

static String

Broadcast action sent when carrier apps should reset their internal state.

static String

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

static String

Broadcast action to be received by Broadcast receivers.

static String

Broadcast intent action for network country code changes.

static String

Broadcast intent action indicating that the call state on the device has changed.

static String

Activity action: Show setting to reset mobile networks.

static String

The Phone app sends this intent when a user opts to respond-via-message during an incoming call.

static String

Broadcast Action: A debug code has been entered in the dialer.

static String

Broadcast intent action for letting the default dialer to know to show voicemail notification.

static String

Broadcast Action: The subscription carrier identity has changed.

static String

Broadcast Action: The subscription specific carrier identity has changed.

static Int

To indicate allowed network type change is requested by carrier.

static Int

To indicate allowed network type change is requested by user.

static Int

UICC application type is CSIM

static Int

UICC application type is ISIM

static Int

UICC application type is RUIM

static Int

UICC application type is SIM

static Int

UICC application type is unknown or not specified

static Int

UICC application type is USIM

static Int

Authentication type for UICC challenge is EAP AKA.

static Int

Authentication type for UICC challenge is EAP SIM.

static Int

Authentication type for GBA Bootstrap Challenge.

static Int

Authentication type for GBA Network Application Functions (NAF) key External Challenge.

static Int

Call composer status Business Only from user setting.

static Int

Call composer status OFF from user setting.

static Int

Call composer status ON from user setting.

static Int

Device call state: No activity.

static Int

Device call state: Off-hook.

static Int

Device call state: Ringing.

static String

Indicates whether getNetworkSlicingConfiguration is supported.

static Int

The device is not restricted to a carrier

static Int

The device is restricted to a carrier.

static Int

The device is restricted to the carrier of the calling application.

static Int

Carrier restriction status value is unknown, in case modem did not provide any information about carrier restriction status.

static Int

Value for CarrierConfigManager#KEY_CDMA_ROAMING_MODE_INT which permits roaming on affiliated networks.

static Int

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

static Int

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

static Int

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.

static Int

Data connection is active, but physical link is down

static Int

Data connection activity: Currently receiving IP PPP traffic.

static Int

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

static Int

Data connection activity: No traffic.

static Int

Data connection activity: Currently sending IP PPP traffic.

static Int

Data connection state: Connected.

static Int

Data connection state: Currently setting up a data connection.

static Int

Data connection state: Disconnected.

static Int

Data connection state: Disconnecting.

static Int

To indicate enable or disable carrier data by the system based on carrier signalling or carrier privileged apps.

static Int

To indicate data was enabled or disabled due to mobile data policy overrides.

static Int

To indicate that data control due to policy.

static Int

To indicate enable or disable data by thermal service.

static Int

To indicate that data was enabled or disabled due to an unknown reason.

static Int

To indicate that user enabled or disabled data.

static Int

Data connection state: Handover in progress.

static Int

Data connection state: Suspended.

static Int

Data connection state: Unknown.

static Int

Default port index for a UICC.

static Int

ERI (Enhanced Roaming Indicator) is FLASH i.

static Int

ERI (Enhanced Roaming Indicator) is OFF i.

static Int

ERI (Enhanced Roaming Indicator) is ON i.

static String

Event reported from the Telephony stack to indicate that the Connection is not able to find any network and likely will not get connected.

static String

The number of active SIM supported by current multi-SIM config.

static String

An integer extra containing the protocol of the apn connection.

static String

An integer extra containing the APN type.

static String

The intent to call voicemail.

static String

An int extra used with ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED which indicates the updated carrier id returned by TelephonyManager#getSimCarrierId().

static String

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

static String

An integer extra containing the data fail cause.

static String

A boolean extra indicating the availability of the default network.

static String

Integer extra key used with EVENT_DISPLAY_EMERGENCY_MESSAGE which indicates the type of handover from emergency call to satellite messaging.

static String

Extra key used with the EVENT_DISPLAY_EMERGENCY_MESSAGE for a PendingIntent which will be launched by the Dialer app.

static String

The boolean value indicating whether the voicemail settings activity launched by ACTION_CONFIGURE_VOICEMAIL should hide settings accessible through public API.

static String

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

static String

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

static String

The extra used with an ACTION_NETWORK_COUNTRY_CHANGED to specify the last known the country code in ISO-3166-1 alpha-2 format.

static String

The intent to launch voicemail settings.

static String

The extra used with an ACTION_NETWORK_COUNTRY_CHANGED to specify the the country code in ISO-3166-1 alpha-2 format.

static String

The number of voice messages associated with the notification.

static String

An integer extra indicating the ID for the PCO data.

static String

A byte array extra containing PCO data read from the modem.

static String

The extra used with an ACTION_CONFIGURE_VOICEMAIL and ACTION_SHOW_VOICEMAIL_NOTIFICATION Intent to specify the PhoneAccountHandle the configuration or notification is for.

static String

String extra containing the redirection URL sent with ACTION_CARRIER_SIGNAL_REDIRECTED.

static String

An int extra used with ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED which indicates the updated specific carrier id returned by TelephonyManager#getSimSpecificCarrierId().

static String

An string extra used with ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED which indicates the updated specific carrier name returned by TelephonyManager#getSimSpecificCarrierIdName().

static String

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

static String

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.

static String

The voicemail number.

static Int

Include coarse location data.

static Int

Include fine location data.

static Int

Specifies to not include any location related data.

static String

A boolean meta-data value indicating whether the voicemail settings should be hidden in the call settings page launched by android.telecom.TelecomManager#ACTION_SHOW_CALL_SETTINGS.

static Int

The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported.

static Int

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.

static Int

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.

static Int

static Int

static Int

static Int

Current network is 1xRTT

static Long

network type bitmask indicating the support of radio tech 1xRTT.

static Long

network type bitmask indicating the support of radio tech CDMA(IS95A/IS95B).

static Long

network type bitmask indicating the support of radio tech EDGE.

static Long

network type bitmask indicating the support of radio tech EHRPD.

static Long

network type bitmask indicating the support of radio tech EVDO 0.

static Long

network type bitmask indicating the support of radio tech EVDO A.

static Long

network type bitmask indicating the support of radio tech EVDO B.

static Long

network type bitmask indicating the support of radio tech GPRS.

static Long

network type bitmask indicating the support of radio tech GSM.

static Long

network type bitmask indicating the support of radio tech HSDPA.

static Long

network type bitmask indicating the support of radio tech HSPA.

static Long

network type bitmask indicating the support of radio tech HSPAP.

static Long

network type bitmask indicating the support of radio tech HSUPA.

static Long

network type bitmask indicating the support of radio tech IWLAN.

static Long

network type bitmask indicating the support of radio tech LTE.

static Long

NOT USED; this bitmask is exposed accidentally.

static Long

network type bitmask indicating the support of radio tech NR(New Radio) 5G.

static Long

network type bitmask indicating the support of radio tech TD_SCDMA.

static Long

network type bitmask indicating the support of radio tech UMTS.

static Long

network type bitmask unknown.

static Int

Current network is CDMA: Either IS95A or IS95B

static Int

Current network is EDGE

static Int

Current network is eHRPD

static Int

Current network is EVDO revision 0

static Int

Current network is EVDO revision A

static Int

Current network is EVDO revision B

static Int

Current network is GPRS

static Int

Current network is GSM

static Int

Current network is HSDPA

static Int

Current network is HSPA

static Int

Current network is HSPA+

static Int

Current network is HSUPA

static Int

Current network is iDen

static Int

Current network is IWLAN

static Int

Current network is LTE

static Int

Current network is NR (New Radio) 5G.

static Int

Current network is TD_SCDMA

static Int

Current network is UMTS

static Int

Network type is unknown

static Int

Phone radio is CDMA.

static Int

Phone radio is GSM.

static Int

No phone radio.

static Int

Phone is via SIP.

static Int

A premium capability that boosts the network to allow for real-time interactive traffic by prioritizing low latency communication.

static Int

Purchase premium capability failed because a request was already made and is in progress.

static Int

Purchase premium capability failed because it is already purchased and available.

static Int

Purchase premium capability failed because the carrier disabled or does not support the capability, as specified in CarrierConfigManager#KEY_SUPPORTED_PREMIUM_CAPABILITIES_INT_ARRAY.

static Int

Purchase premium capability failed because the carrier app did not indicate success.

static Int

Purchase premium capability failed because the entitlement check failed.

static Int

Purchase premium capability failed because the device does not support the feature.

static Int

Purchase premium capability failed because the network is not available.

static Int

Purchase premium capability failed because the request was not made on the default data subscription, indicated by SubscriptionManager#getDefaultDataSubscriptionId().

static Int

Purchase premium capability failed because the requesting application is not in the foreground.

static Int

Purchase premium capability was successful and is waiting for the network to setup the slicing configuration.

static Int

Purchase premium capability failed because the telephony service is unavailable or there was an error in the phone process.

static Int

Purchase premium capability request was successful.

static Int

Purchase premium capability failed because the request is throttled.

static Int

Purchase premium capability failed because we did not receive a response from the user for the performance boost notification within the time specified by CarrierConfigManager#KEY_PREMIUM_CAPABILITY_NOTIFICATION_DISPLAY_TIMEOUT_MILLIS_LONG.

static Int

Purchase premium capability failed because the user canceled the operation.

static Int

Purchase premium capability failed because the user disabled the feature.

static Int

The subscription is not valid.

static Int

The subscription is not valid.

static Int

Subscription service happened remote exception.

static Int

No error.

static Int

Validation failed when trying to switch to preferred subscription.

static Int

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

static Int

SIM card state: SIM Card Error, present but faulty

static Int

SIM card state: SIM Card restricted, present but not usable due to carrier restrictions.

static Int

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

static Int

SIM card state: SIM Card is NOT READY

static Int

SIM card state: SIM Card Error, permanently disabled

static Int

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

static Int

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

static Int

SIM card state: Ready

static Int

SIM card state: Unknown.

static Int

A UICC card identifier used before the UICC card is loaded.

static Int

An unknown carrier id.

static Int

A UICC card identifier used if the device does not support the operation.

static Int

The request is aborted.

static Int

Disable modem fail.

static Int

Enable modem fail.

static Int

The parameter passed in is invalid.

static Int

Carrier app does not support multiple available networks.

static Int

No carrier privilege.

static Int

The subscription is not valid.

static Int

There is no OpportunisticNetworkService.

static Int

OpportunisticNetworkService is disabled.

static Int

No error.

static Int

There is a unknown failure happened.

static Int

Failure code returned when a USSD request has failed to execute because the Telephony service is unavailable.

static Int

Failed code returned when the mobile network has failed to complete a USSD request.

static String

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

static String

The OMTP protocol.

Public methods
open Boolean

Whether the device supports configuring the DTMF tone length.

open Unit

Clear a SignalStrengthUpdateRequest from the system.

open TelephonyManager?

Create a new TelephonyManager object pinned to the subscription ID associated with the given phone account.

open TelephonyManager!

Create a new TelephonyManager object pinned to the given subscription ID.

open Boolean

Get whether making changes to modem configurations by switchMultiSimConfig(int) will trigger device reboot.

open Int

Returns the number of logical modems currently configured to be activated.

open MutableList<CellInfo!>!

Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells.

open Long

Get the allowed network types for certain reason.

open Int

Get the user-set status for enriched calling with call composer.

open Int

Returns the state of all calls on the device.

open Int

Retrieve the call state for a specific subscription that was specified when this TelephonyManager instance was created.

open Int

Get the card ID of the default eUICC card.

open PersistableBundle!

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

open Int

Returns carrier id based on sim MCCMNC (returned by getSimOperator()) only.

open Unit
getCarrierRestrictionStatus(executor: Executor, resultListener: Consumer<Int!>)

Get the carrier restriction status of the device.

open CellLocation!

Returns the current location of the device.

open Int

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

open Int

Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission.

open Int

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

open String!

Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones.

open String!
getDeviceId(slotIndex: Int)

Returns the unique device ID of a subscription, for example, the IMEI for GSM and the MEID for CDMA phones.

open String?

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

open MutableMap<Int!, MutableList<EmergencyNumber!>!>

Get the emergency number list based on current locale, sim, default, modem and network.

open MutableMap<Int!, MutableList<EmergencyNumber!>!>

Get the per-category emergency number list based on current locale, sim, default, modem and network.

open MutableList<String!>

Returns a list of the equivalent home PLMNs (EF_EHPLMN) from the USIM app.

open Array<String!>!

Returns an array of Forbidden PLMNs from the USIM App Returns null if the query fails.

open String!

Returns the Group Identifier Level1 for a GSM phone.

open String!
getIccAuthentication(appType: Int, authType: Int, data: String!)

Returns the response of authentication for the default subscription.

open String!

Returns the IMEI (International Mobile Equipment Identity).

open String!
getImei(slotIndex: Int)

Returns the IMEI (International Mobile Equipment Identity).

open String!

Returns the phone number string for line 1, for example, the MSISDN for a GSM phone for a particular subscription.

open String

Get the PLMN chosen for Manual Network Selection if active.

open String?

Returns the Manufacturer Code from the MEID.

open String?

Returns the Manufacturer Code from the MEID.

open static Long

Indicates the maximum size of the call composure picture.

open String!

Returns the MEID (Mobile Equipment Identifier).

open String!
getMeid(slotIndex: Int)

Returns the MEID (Mobile Equipment Identifier).

open String!

Returns the MMS user agent profile URL.

open String!

Returns the MMS user agent.

open String!

Returns the Network Access Identifier (NAI).

open String!

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.

open String

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.

open String!

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

open String!

Returns the alphabetic name of current registered operator.

open Int

Get the network selection mode.

open Unit

Request to get the current slicing configuration including URSP rules and NSSAIs (configured, allowed and rejected).

open String!

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

open Int

Return the current data network type.

open PhoneAccountHandle?

Determines the PhoneAccountHandle associated with this TelephonyManager.

open Int

Returns the number of phones available.

open Int

Returns a constant indicating the device phone type.

open Int

Get preferred opportunistic data subscription Id

open String

Returns the primary IMEI (International Mobile Equipment Identity) of the device as mentioned in GSMA TS.

open ServiceState?

Returns the current ServiceState information.

open ServiceState?
getServiceState(includeLocationData: Int)

Returns the current ServiceState information.

open SignalStrength?

Get the most recently available signal strength information.

open Int

Returns carrier id of the current subscription.

open CharSequence?

Returns carrier id name of the current subscription.

open String!

Returns the ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.

open String!

Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM.

open String!

Returns the Service Provider Name (SPN).

open String!

Returns the serial number of the SIM, if applicable.

open Int

Returns fine-grained carrier ID of the current subscription.

open CharSequence?

Similar like getSimCarrierIdName(), returns user-facing name of the specific carrier id returned by getSimSpecificCarrierId().

open Int

Returns a constant indicating the state of the default SIM card.

open Int
getSimState(slotIndex: Int)

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

open String!

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

open Int

Return an appropriate subscription ID for any situation.

open Int

Returns the subscription ID for the given phone account handle.

open Int

Return how many logical modem can be potentially active simultaneously, in terms of hardware capability.

open Long


Requires android.

open String?

Returns the Type Allocation Code from the IMEI.

open String?

Returns the Type Allocation Code from the IMEI.

open MutableList<UiccCardInfo!>

Gets information about currently inserted UICCs and eUICCs.

open String?

Returns the package responsible of processing visual voicemail for the subscription ID pinned to the TelephonyManager.

open String!

Retrieves the alphabetic identifier associated with the voice mail number.

open String!

Returns the voice mail number.

open Int

Returns the NETWORK_TYPE_xxxx for voice

open Uri?

Returns the URI for the per-account voicemail ringtone set in Phone settings.

open Boolean

Has the calling application been granted carrier privileges by the carrier.

open Boolean

This API is used to check if there is an ICC card present in the device.

open Boolean

Closes a previously opened logical channel to the ICC card.

open ByteArray!
iccExchangeSimIO(fileID: Int, command: Int, p1: Int, p2: Int, p3: Int, filePath: String!)

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

open IccOpenLogicalChannelResponse!

Opens a logical channel to the ICC card.

open IccOpenLogicalChannelResponse!

Opens a logical channel to the ICC card.

open String!
iccTransmitApduBasicChannel(cla: Int, instruction: Int, p1: Int, p2: Int, p3: Int, data: String!)

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

open String!
iccTransmitApduLogicalChannel(channel: Int, cla: Int, instruction: Int, p1: Int, p2: Int, p3: Int, data: String!)

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

open Boolean

Whether the device is currently on a technology (e.g. UMTS or LTE) which can support voice and data simultaneously.

open Boolean


Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

open Boolean

Checks whether cellular data connection is allowed in the device.

open Boolean

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

open Boolean

Return whether data is enabled for certain reason .

open Boolean

Returns whether mobile data roaming is enabled on the subscription.

open Boolean


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

open Boolean


Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

open Boolean

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.

open Boolean

Whether the phone supports hearing aid compatibility.

open Boolean

Checks if manual network selection is allowed.

open Boolean

Indicates whether or not there is a modem stack enabled for the given SIM slot.

open Int

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.

open Boolean

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

open Boolean

Check whether the given premium capability is available for purchase from the carrier.

open Boolean

Whether the device supports a given capability on the radio interface.

open Boolean

Determines whether the device currently supports RTT (Real-time text).

open Boolean


Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

open Boolean

open Boolean


Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

open Boolean

Returns whether vibration is set for voicemail notification in Phone settings.

open Boolean

Whether the device is a world phone.

open Unit
listen(listener: PhoneStateListener!, events: Int)

Registers a listener object to receive notification of changes in specified telephony states.

open Unit
purchasePremiumCapability(capability: Int, executor: Executor, callback: Consumer<Int!>)

Purchase the given premium capability from the carrier.

open Unit

Generate a radio modem reset.

open Unit

Registers a callback object to receive notification of changes in specified telephony states.

open Unit
registerTelephonyCallback(includeLocationData: Int, executor: Executor, callback: TelephonyCallback)

Registers a callback object to receive notification of changes in specified telephony states.

open Unit

Requests all available cell information from the current subscription for observed camped/registered, serving, and neighboring cells.

open NetworkScan!

Request a network scan.

open NetworkScan?
requestNetworkScan(includeLocationData: Int, request: NetworkScanRequest, executor: Executor, callback: TelephonyScanManager.NetworkScanCallback)

Request a network scan.

open Unit

Send the special dialer code.

open String!

Send ENVELOPE to the SIM and return the response.

open Unit
sendUssdRequest(ussdRequest: String!, callback: TelephonyManager.UssdResponseCallback!, 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.

open Unit
sendVisualVoicemailSms(number: String!, port: Int, text: String!, sentIntent: PendingIntent!)

Send a visual voicemail SMS.

open Unit
setAllowedNetworkTypesForReason(reason: Int, allowedNetworkTypes: Long)

Set the allowed network types of the device and provide the reason triggering the allowed network change.

open Unit

Set the user-set status for enriched calling with call composer.

open Unit

Turns mobile data on or off.

open Unit
setDataEnabledForReason(reason: Int, enabled: Boolean)

Control of data connection and provide the reason triggering the data connection control.

open Int

Replace the contents of the forbidden PLMN SIM file with the provided values.

open Boolean
setLine1NumberForDisplay(alphaTag: String!, number: String!)

Set the line 1 phone number string and its alphatag for the current ICCID for display purpose only, for example, displayed in Phone Status.

open Unit

Sets the network selection mode to automatic.

open Boolean
setNetworkSelectionModeManual(operatorNumeric: String!, persistSelection: Boolean)

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

open Boolean
setNetworkSelectionModeManual(operatorNumeric: String, persistSelection: Boolean, ran: Int)

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

open Boolean

Override the branding for the current ICCID.

open Boolean

Set the preferred network type to global mode which includes NR, LTE, CDMA, EvDo and GSM/WCDMA.

open Unit
setPreferredOpportunisticDataSubscription(subId: Int, needValidation: Boolean, executor: Executor?, callback: Consumer<Int!>?)

Set preferred opportunistic data subscription id.

open Unit

Set a SignalStrengthUpdateRequest to receive notification when signal quality measurements breach the specified thresholds.

open Unit

Set the visual voicemail SMS filter settings for the subscription ID pinned to the TelephonyManager.

open Boolean
setVoiceMailNumber(alphaTag: String!, number: String!)

Sets the voice mail number.

open Unit
setVoicemailRingtoneUri(phoneAccountHandle: PhoneAccountHandle!, uri: Uri!)

Sets the per-account voicemail ringtone.

open Unit
setVoicemailVibrationEnabled(phoneAccountHandle: PhoneAccountHandle!, enabled: Boolean)

Sets the per-account preference whether vibration is enabled for voicemail notifications.

open Unit

Switch configs to enable multi-sim or switch back to single-sim

open Unit

Unregister an existing TelephonyCallback.

open Unit
updateAvailableNetworks(availableNetworks: MutableList<AvailableNetworkInfo!>, executor: Executor?, callback: Consumer<Int!>?)

Update availability of a list of networks in the current location.

open Unit

Uploads a picture to the carrier network for use with call composer.

open Unit

Uploads a picture to the carrier network for use with call composer.

Properties
static String!

Value used with EXTRA_STATE corresponding to CALL_STATE_IDLE.

static String!

Value used with EXTRA_STATE corresponding to CALL_STATE_OFFHOOK.

static String!

Value used with EXTRA_STATE corresponding to CALL_STATE_RINGING.

Constants

ACTION_CARRIER_MESSAGING_CLIENT_SERVICE

Added in API level 29
static val ACTION_CARRIER_MESSAGING_CLIENT_SERVICE: String

A service action that identifies a android.service.carrier.CarrierMessagingClientService subclass in the AndroidManifest.xml.

See android.service.carrier.CarrierMessagingClientService for the details.

Value: "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE"

ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE

Added in API level 31
static val ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE: String

Broadcast action sent when the availability of the system default network changes.

Value: "android.telephony.action.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE"

ACTION_CARRIER_SIGNAL_PCO_VALUE

Added in API level 31
static val ACTION_CARRIER_SIGNAL_PCO_VALUE: String

Broadcast action sent when a PCO value becomes available from the modem. This action is intended for sim/account status checks and only sent to the carrier apps specified in the carrier config for the subscription ID that's attached to this intent. The intent will have the following extra values:

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

Value: "android.telephony.action.CARRIER_SIGNAL_PCO_VALUE"

ACTION_CARRIER_SIGNAL_REDIRECTED

Added in API level 31
static val ACTION_CARRIER_SIGNAL_REDIRECTED: String

Broadcast action sent when a data connection is redirected with validation failure. This action is intended for sim/account status checks and only sent to the carrier apps specified in the carrier config for the subscription ID that's attached to this intent. The intent will have the following extra values:

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

Value: "android.telephony.action.CARRIER_SIGNAL_REDIRECTED"

ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED

Added in API level 31
static val ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED: String

Broadcast action sent when a data connection setup fails. This action is intended for sim/account status checks and only sent to the carrier apps specified in the carrier config for the subscription ID that's attached to this intent. The intent will have the following extra values:

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

Value: "android.telephony.action.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED"

ACTION_CARRIER_SIGNAL_RESET

Added in API level 31
static val ACTION_CARRIER_SIGNAL_RESET: String

Broadcast action sent when carrier apps should reset their internal state. Sent when certain events such as turning on/off mobile data, removing the SIM, etc. require carrier apps to reset their state. This action is intended to signal carrier apps to perform cleanup operations. It is only sent to the carrier apps specified in the carrier config for the subscription ID attached to this intent. The intent will have the following extra values:

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

Value: "android.telephony.action.CARRIER_SIGNAL_RESET"

ACTION_CONFIGURE_VOICEMAIL

Added in API level 23
static val ACTION_CONFIGURE_VOICEMAIL: String

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.

Value: "android.telephony.action.CONFIGURE_VOICEMAIL"

ACTION_MULTI_SIM_CONFIG_CHANGED

Added in API level 30
static val ACTION_MULTI_SIM_CONFIG_CHANGED: String

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.

Value: "android.telephony.action.MULTI_SIM_CONFIG_CHANGED"

ACTION_NETWORK_COUNTRY_CHANGED

Added in API level 29
static val ACTION_NETWORK_COUNTRY_CHANGED: String

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.

Value: "android.telephony.action.NETWORK_COUNTRY_CHANGED"

ACTION_PHONE_STATE_CHANGED

Added in API level 3
static val ACTION_PHONE_STATE_CHANGED: String

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 android.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 android.Manifest.permission#READ_CALL_LOG and android.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 android.content.Context#sendStickyBroadcast broadcast in version 1.0, but it is no longer sticky. Instead, use getCallState to synchronously query the current call state.
Requires android.Manifest.permission#READ_PHONE_STATE

Value: "android.intent.action.PHONE_STATE"

ACTION_RESET_MOBILE_NETWORK_SETTINGS

Added in API level 35
static val ACTION_RESET_MOBILE_NETWORK_SETTINGS: String

Activity action: Show setting to reset mobile networks.

On devices with a settings activity to reset mobile networks, the activity should be launched without additional permissions.

On some devices, this settings activity may not exist. Callers should ensure that this case is appropriately handled.

Value: "android.telephony.action.RESET_MOBILE_NETWORK_SETTINGS"

ACTION_RESPOND_VIA_MESSAGE

Added in API level 18
static val ACTION_RESPOND_VIA_MESSAGE: String

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 android.app.Service and sending the message using its own messaging system.

The intent contains a URI (available from android.content.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 android.content.Intent#EXTRA_TEXT) and a message subject (in android.content.Intent#EXTRA_SUBJECT).

Note: The intent-filter that consumes this Intent needs to be in a android.app.Service that requires the permission android.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.

Value: "android.intent.action.RESPOND_VIA_MESSAGE"

ACTION_SECRET_CODE

Added in API level 29
static val ACTION_SECRET_CODE: String

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 android.provider.Telephony.Sms.Intents#SECRET_CODE_ACTION in the next Android version. Before that both of these two actions will be broadcast.

Value: "android.telephony.action.SECRET_CODE"

ACTION_SHOW_VOICEMAIL_NOTIFICATION

Added in API level 26
static val ACTION_SHOW_VOICEMAIL_NOTIFICATION: String

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

Value: "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION"

ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED

Added in API level 28
static val ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED: String

Broadcast Action: The subscription carrier identity has changed. This intent could be sent on the following events:

The intent will have the following extra values:

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

Value: "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED"

ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED

Added in API level 29
static val ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED: String

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.

Value: "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED"

ALLOWED_NETWORK_TYPES_REASON_CARRIER

Added in API level 33
static val ALLOWED_NETWORK_TYPES_REASON_CARRIER: Int

To indicate allowed network type change is requested by carrier. Carrier configuration won't affect the settings configured through other reasons and will result in allowing network types that are in both configurations (i.e intersection of both sets).

Value: 2

ALLOWED_NETWORK_TYPES_REASON_USER

Added in API level 33
static val ALLOWED_NETWORK_TYPES_REASON_USER: Int

To indicate allowed network type change is requested by user.

Value: 0

APPTYPE_CSIM

Added in API level 24
static val APPTYPE_CSIM: Int

UICC application type is CSIM

Value: 4

APPTYPE_ISIM

Added in API level 24
static val APPTYPE_ISIM: Int

UICC application type is ISIM

Value: 5

APPTYPE_RUIM

Added in API level 24
static val APPTYPE_RUIM: Int

UICC application type is RUIM

Value: 3

APPTYPE_SIM

Added in API level 24
static val APPTYPE_SIM: Int

UICC application type is SIM

Value: 1

APPTYPE_UNKNOWN

Added in API level 31
static val APPTYPE_UNKNOWN: Int

UICC application type is unknown or not specified

Value: 0

APPTYPE_USIM

Added in API level 24
static val APPTYPE_USIM: Int

UICC application type is USIM

Value: 2

AUTHTYPE_EAP_AKA

Added in API level 24
static val AUTHTYPE_EAP_AKA: Int

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

Value: 129

AUTHTYPE_EAP_SIM

Added in API level 24
static val AUTHTYPE_EAP_SIM: Int

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

Value: 128

AUTHTYPE_GBA_BOOTSTRAP

Added in API level 34
static val AUTHTYPE_GBA_BOOTSTRAP: Int

Authentication type for GBA Bootstrap Challenge. Pass this authentication type into the getIccAuthentication API to perform a GBA Bootstrap challenge (BSF), with data (generated according to the procedure defined in 3GPP 33.220 Section 5.3.2 step.4) in base64 encoding. This method will return the Bootstrapping response in base64 encoding when ICC authentication is completed. Ref 3GPP 33.220 Section 5.3.2.

Value: 132

AUTHTYPE_GBA_NAF_KEY_EXTERNAL

Added in API level 34
static val AUTHTYPE_GBA_NAF_KEY_EXTERNAL: Int

Authentication type for GBA Network Application Functions (NAF) key External Challenge. Pass this authentication type into the getIccAuthentication API to perform a GBA Network Applications Functions (NAF) key External challenge using the NAF_ID parameter as the data in base64 encoding. This method will return the Ks_Ext_Naf key in base64 encoding when ICC authentication is completed. Ref 3GPP 33.220 Section 5.3.2.

Value: 133

CALL_COMPOSER_STATUS_BUSINESS_ONLY

Added in API level 35
static val CALL_COMPOSER_STATUS_BUSINESS_ONLY: Int

Call composer status Business Only from user setting.

Value: 2

CALL_COMPOSER_STATUS_OFF

Added in API level 31
static val CALL_COMPOSER_STATUS_OFF: Int

Call composer status OFF from user setting.

Value: 0

CALL_COMPOSER_STATUS_ON

Added in API level 31
static val CALL_COMPOSER_STATUS_ON: Int

Call composer status ON from user setting.

Value: 1

CALL_STATE_IDLE

Added in API level 1
static val CALL_STATE_IDLE: Int

Device call state: No activity.

Value: 0

CALL_STATE_OFFHOOK

Added in API level 1
static val CALL_STATE_OFFHOOK: Int

Device call state: Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting.

Value: 2

CALL_STATE_RINGING

Added in API level 1
static val CALL_STATE_RINGING: Int

Device call state: Ringing. A new call arrived and is ringing or waiting. In the latter case, another call is already active.

Value: 1

CAPABILITY_SLICING_CONFIG_SUPPORTED

Added in API level 31
static val CAPABILITY_SLICING_CONFIG_SUPPORTED: String

Indicates whether getNetworkSlicingConfiguration is supported. See comments on respective methods for more information.

Value: "CAPABILITY_SLICING_CONFIG_SUPPORTED"

CARRIER_RESTRICTION_STATUS_NOT_RESTRICTED

Added in API level 34
static val CARRIER_RESTRICTION_STATUS_NOT_RESTRICTED: Int

The device is not restricted to a carrier

Value: 1

CARRIER_RESTRICTION_STATUS_RESTRICTED

Added in API level 34
static val CARRIER_RESTRICTION_STATUS_RESTRICTED: Int

The device is restricted to a carrier.

Value: 2

CARRIER_RESTRICTION_STATUS_RESTRICTED_TO_CALLER

Added in API level 34
static val CARRIER_RESTRICTION_STATUS_RESTRICTED_TO_CALLER: Int

The device is restricted to the carrier of the calling application.

Value: 3

CARRIER_RESTRICTION_STATUS_UNKNOWN

Added in API level 34
static val CARRIER_RESTRICTION_STATUS_UNKNOWN: Int

Carrier restriction status value is unknown, in case modem did not provide any information about carrier restriction status.

Value: 0

CDMA_ROAMING_MODE_AFFILIATED

Added in API level 28
static val CDMA_ROAMING_MODE_AFFILIATED: Int

Value for CarrierConfigManager#KEY_CDMA_ROAMING_MODE_INT which permits roaming on affiliated networks.

Value: 1

CDMA_ROAMING_MODE_ANY

Added in API level 28
static val CDMA_ROAMING_MODE_ANY: Int

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

Value: 2

CDMA_ROAMING_MODE_HOME

Added in API level 28
static val CDMA_ROAMING_MODE_HOME: Int

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

Value: 0

CDMA_ROAMING_MODE_RADIO_DEFAULT

Added in API level 28
static val CDMA_ROAMING_MODE_RADIO_DEFAULT: Int

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.

Value: -1

DATA_ACTIVITY_DORMANT

Added in API level 4
static val DATA_ACTIVITY_DORMANT: Int

Data connection is active, but physical link is down

Value: 4

DATA_ACTIVITY_IN

Added in API level 1
static val DATA_ACTIVITY_IN: Int

Data connection activity: Currently receiving IP PPP traffic.

Value: 1

DATA_ACTIVITY_INOUT

Added in API level 1
static val DATA_ACTIVITY_INOUT: Int

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

Value: 3

DATA_ACTIVITY_NONE

Added in API level 1
static val DATA_ACTIVITY_NONE: Int

Data connection activity: No traffic.

Value: 0

DATA_ACTIVITY_OUT

Added in API level 1
static val DATA_ACTIVITY_OUT: Int

Data connection activity: Currently sending IP PPP traffic.

Value: 2

DATA_CONNECTED

Added in API level 1
static val DATA_CONNECTED: Int

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

Value: 2

DATA_CONNECTING

Added in API level 1
static val DATA_CONNECTING: Int

Data connection state: Currently setting up a data connection.

Value: 1

DATA_DISCONNECTED

Added in API level 1
static val DATA_DISCONNECTED: Int

Data connection state: Disconnected. IP traffic not available.

Value: 0

DATA_DISCONNECTING

Added in API level 30
static val DATA_DISCONNECTING: Int

Data connection state: Disconnecting. IP traffic may be available but will cease working imminently.

Value: 4

DATA_ENABLED_REASON_CARRIER

Added in API level 31
static val DATA_ENABLED_REASON_CARRIER: Int

To indicate enable or disable carrier data by the system based on carrier signalling or carrier privileged apps. Carrier data on/off won't affect user settings but will bypass the settings and turns off data internally if set to false.

Value: 2

DATA_ENABLED_REASON_OVERRIDE

Added in API level 33
static val DATA_ENABLED_REASON_OVERRIDE: Int

To indicate data was enabled or disabled due to mobile data policy overrides. Note that this is not a valid reason for setDataEnabledForReason(int,boolean) and is only used to indicate that data enabled was changed due to an override.

Value: 4

DATA_ENABLED_REASON_POLICY

Added in API level 31
static val DATA_ENABLED_REASON_POLICY: Int

To indicate that data control due to policy. Usually used when data limit is passed. Policy data on/off won't affect user settings but will bypass the settings and turns off data internally if set to false.

Value: 1

DATA_ENABLED_REASON_THERMAL

Added in API level 31
static val DATA_ENABLED_REASON_THERMAL: Int

To indicate enable or disable data by thermal service. Thermal data on/off won't affect user settings but will bypass the settings and turns off data internally if set to false.

Value: 3

DATA_ENABLED_REASON_UNKNOWN

Added in API level 33
static val DATA_ENABLED_REASON_UNKNOWN: Int

To indicate that data was enabled or disabled due to an unknown reason. Note that this is not a valid reason for setDataEnabledForReason(int,boolean) and is only used to indicate that data enabled was changed.

Value: -1

DATA_ENABLED_REASON_USER

Added in API level 31
static val DATA_ENABLED_REASON_USER: Int

To indicate that user enabled or disabled data.

Value: 0

DATA_HANDOVER_IN_PROGRESS

Added in API level 33
static val DATA_HANDOVER_IN_PROGRESS: Int

Data connection state: Handover in progress. The connection is being transited from cellular network to IWLAN, or from IWLAN to cellular network.

Value: 5

DATA_SUSPENDED

Added in API level 1
static val DATA_SUSPENDED: Int

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.

Value: 3

DATA_UNKNOWN

Added in API level 29
static val DATA_UNKNOWN: Int

Data connection state: Unknown. Used before we know the state.

Value: -1

DEFAULT_PORT_INDEX

Added in API level 33
static val DEFAULT_PORT_INDEX: Int

Default port index for a UICC. On physical SIM cards the only available port is 0. See android.telephony.UiccPortInfo for more information on ports. See android.telephony.euicc.EuiccManager#isSimPortAvailable(int) for information on how portIndex is used on eUICCs.

Value: 0

ERI_FLASH

Added in API level 31
static val ERI_FLASH: Int

ERI (Enhanced Roaming Indicator) is FLASH i.e value 2 defined by 3GPP2 C.R1001-H v1.0 Table 8.1-1.

Value: 2

ERI_OFF

Added in API level 31
static val ERI_OFF: Int

ERI (Enhanced Roaming Indicator) is OFF i.e value 1 defined by 3GPP2 C.R1001-H v1.0 Table 8.1-1.

Value: 1

ERI_ON

Added in API level 31
static val ERI_ON: Int

ERI (Enhanced Roaming Indicator) is ON i.e value 0 defined by 3GPP2 C.R1001-H v1.0 Table 8.1-1.

Value: 0

EVENT_DISPLAY_EMERGENCY_MESSAGE

Added in API level 35
static val EVENT_DISPLAY_EMERGENCY_MESSAGE: String

Event reported from the Telephony stack to indicate that the Connection is not able to find any network and likely will not get connected. Upon receiving this event, the dialer app should start the app included in the extras bundle of this event if satellite is provisioned.

The dialer app receives this event via Call.Callback#onConnectionEvent(Call, String, Bundle).

The Bundle parameter is guaranteed to include the following extras if the below conditions are met:

If the device is connected to satellite via carrier within the hysteresis time defined by the carrier config CarrierConfigManager#KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT, the component of the EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT will be set to the default SMS app.

Otherwise, if the overlay config config_oem_enabled_satellite_handover_app is present, the app defined by this config will be used as the component of the EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT. If this overlay config is empty, EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT will not be included in the event EVENT_DISPLAY_EMERGENCY_MESSAGE.

Value: "android.telephony.event.DISPLAY_EMERGENCY_MESSAGE"

EXTRA_ACTIVE_SIM_SUPPORTED_COUNT

Added in API level 30
static val EXTRA_ACTIVE_SIM_SUPPORTED_COUNT: String

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

Value: "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT"

EXTRA_APN_PROTOCOL

Added in API level 31
static val EXTRA_APN_PROTOCOL: String

An integer extra containing the protocol of the apn connection. Sent with the ACTION_CARRIER_SIGNAL_PCO_VALUE broadcast. See the PROTOCOL_* constants in ApnSetting for a list of possible values.

Value: "android.telephony.extra.APN_PROTOCOL"

EXTRA_APN_TYPE

Added in API level 31
static val EXTRA_APN_TYPE: String

An integer extra containing the APN type. Sent with the ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED, ACTION_CARRIER_SIGNAL_REDIRECTED, and ACTION_CARRIER_SIGNAL_PCO_VALUE broadcasts. See the TYPE_ constants in ApnSetting for a list of possible values.

Value: "android.telephony.extra.APN_TYPE"

EXTRA_CALL_VOICEMAIL_INTENT

Added in API level 26
static val EXTRA_CALL_VOICEMAIL_INTENT: String

The intent to call voicemail.

Value: "android.telephony.extra.CALL_VOICEMAIL_INTENT"

EXTRA_CARRIER_ID

Added in API level 28
static val EXTRA_CARRIER_ID: String

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.

Value: "android.telephony.extra.CARRIER_ID"

EXTRA_CARRIER_NAME

Added in API level 28
static val EXTRA_CARRIER_NAME: String

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

Value: "android.telephony.extra.CARRIER_NAME"

EXTRA_DATA_FAIL_CAUSE

Added in API level 31
static val EXTRA_DATA_FAIL_CAUSE: String

An integer extra containing the data fail cause. Sent with ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED. See DataFailCause for a list of possible values.

Value: "android.telephony.extra.DATA_FAIL_CAUSE"

EXTRA_DEFAULT_NETWORK_AVAILABLE

Added in API level 31
static val EXTRA_DEFAULT_NETWORK_AVAILABLE: String

A boolean extra indicating the availability of the default network. Sent with the ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE broadcast.

Value: "android.telephony.extra.DEFAULT_NETWORK_AVAILABLE"

EXTRA_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE

Added in API level 35
static val EXTRA_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE: String

Integer extra key used with EVENT_DISPLAY_EMERGENCY_MESSAGE which indicates the type of handover from emergency call to satellite messaging.

Will be either android.telephony.satellite.SatelliteManager#EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS or android.telephony.satellite.SatelliteManager#EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911

Set in the extras for the EVENT_DISPLAY_EMERGENCY_MESSAGE connection event.

Value: "android.telephony.extra.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE"

EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT

Added in API level 35
static val EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT: String

Extra key used with the EVENT_DISPLAY_EMERGENCY_MESSAGE for a PendingIntent which will be launched by the Dialer app.

Value: "android.telephony.extra.EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT"

EXTRA_HIDE_PUBLIC_SETTINGS

Added in API level 26
static val EXTRA_HIDE_PUBLIC_SETTINGS: String

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.

Value: "android.telephony.extra.HIDE_PUBLIC_SETTINGS"

EXTRA_INCOMING_NUMBER

Added in API level 3
Deprecated in API level 29
static val EXTRA_INCOMING_NUMBER: String

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 android.Manifest.permission#READ_CALL_LOG and android.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 android.content.Intent#getStringExtra(String).

Value: "incoming_number"

EXTRA_IS_REFRESH

Added in API level 27
static val EXTRA_IS_REFRESH: String

Boolean value representing whether the android.telephony.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.

Value: "android.telephony.extra.IS_REFRESH"

EXTRA_LAST_KNOWN_NETWORK_COUNTRY

Added in API level 34
static val EXTRA_LAST_KNOWN_NETWORK_COUNTRY: String

The extra used with an ACTION_NETWORK_COUNTRY_CHANGED to specify the last known the country code in ISO-3166-1 alpha-2 format. This might be an empty string when the country code was never available. The last known country code persists across reboot.

Retrieve with android.content.Intent#getStringExtra(String).

Value: "android.telephony.extra.LAST_KNOWN_NETWORK_COUNTRY"

EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT

Added in API level 26
static val EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT: String

The intent to launch voicemail settings.

Value: "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT"

EXTRA_NETWORK_COUNTRY

Added in API level 29
static val EXTRA_NETWORK_COUNTRY: String

The extra used with an ACTION_NETWORK_COUNTRY_CHANGED to specify the the country code in ISO-3166-1 alpha-2 format. This is the same country code returned by getNetworkCountryIso(). This might be an empty string when the country code is not available.

Retrieve with android.content.Intent#getStringExtra(String).

Value: "android.telephony.extra.NETWORK_COUNTRY"

EXTRA_NOTIFICATION_COUNT

Added in API level 26
static val EXTRA_NOTIFICATION_COUNT: String

The number of voice messages associated with the notification.

Value: "android.telephony.extra.NOTIFICATION_COUNT"

EXTRA_PCO_ID

Added in API level 31
static val EXTRA_PCO_ID: String

An integer extra indicating the ID for the PCO data. Sent with the ACTION_CARRIER_SIGNAL_PCO_VALUE broadcast.

Value: "android.telephony.extra.PCO_ID"

EXTRA_PCO_VALUE

Added in API level 31
static val EXTRA_PCO_VALUE: String

A byte array extra containing PCO data read from the modem. Sent with the ACTION_CARRIER_SIGNAL_PCO_VALUE broadcast.

Value: "android.telephony.extra.PCO_VALUE"

EXTRA_PHONE_ACCOUNT_HANDLE

Added in API level 26
static val EXTRA_PHONE_ACCOUNT_HANDLE: String

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 android.content.Intent#getParcelableExtra(String).

Value: "android.telephony.extra.PHONE_ACCOUNT_HANDLE"

EXTRA_REDIRECTION_URL

Added in API level 31
static val EXTRA_REDIRECTION_URL: String

String extra containing the redirection URL sent with ACTION_CARRIER_SIGNAL_REDIRECTED.

Value: "android.telephony.extra.REDIRECTION_URL"

EXTRA_SPECIFIC_CARRIER_ID

Added in API level 29
static val EXTRA_SPECIFIC_CARRIER_ID: String

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.

Value: "android.telephony.extra.SPECIFIC_CARRIER_ID"

EXTRA_SPECIFIC_CARRIER_NAME

Added in API level 29
static val EXTRA_SPECIFIC_CARRIER_NAME: String

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

Value: "android.telephony.extra.SPECIFIC_CARRIER_NAME"

EXTRA_STATE

Added in API level 3
static val EXTRA_STATE: String

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

Retrieve with android.content.Intent#getStringExtra(String).

Value: "state"

EXTRA_SUBSCRIPTION_ID

Added in API level 28
static val EXTRA_SUBSCRIPTION_ID: String

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.

Value: "android.telephony.extra.SUBSCRIPTION_ID"

EXTRA_VOICEMAIL_NUMBER

Added in API level 26
static val EXTRA_VOICEMAIL_NUMBER: String

The voicemail number.

Value: "android.telephony.extra.VOICEMAIL_NUMBER"

INCLUDE_LOCATION_DATA_COARSE

Added in API level 33
static val INCLUDE_LOCATION_DATA_COARSE: Int

Include coarse location data. Indicates whether the caller would not like to receive location related information which will be sent if the caller already possess android.Manifest.permission#ACCESS_COARSE_LOCATION and do not renounce the permissions.

Value: 1

INCLUDE_LOCATION_DATA_FINE

Added in API level 33
static val INCLUDE_LOCATION_DATA_FINE: Int

Include fine location data. Indicates whether the caller would not like to receive location related information which will be sent if the caller already possess android.Manifest.permission#ACCESS_FINE_LOCATION and do not renounce the permissions.

Value: 2

INCLUDE_LOCATION_DATA_NONE

Added in API level 33
static val INCLUDE_LOCATION_DATA_NONE: Int

Specifies to not include any location related data. Indicates whether the caller would not like to receive location related information which will be sent if the caller already possess android.Manifest.permission#ACCESS_COARSE_LOCATION and do not renounce the permissions.

Value: 0

METADATA_HIDE_VOICEMAIL_SETTINGS_MENU

Added in API level 26
static val METADATA_HIDE_VOICEMAIL_SETTINGS_MENU: String

A boolean meta-data value indicating whether the voicemail settings should be hidden in the call settings page launched by android.telecom.TelecomManager#ACTION_SHOW_CALL_SETTINGS. Dialer implementations (see android.telecom.TelecomManager#getDefaultDialerPackage()) which would also like to manage voicemail settings should set this meta-data to true in the manifest registration of their application.

Value: "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU"

MULTISIM_ALLOWED

Added in API level 29
static val MULTISIM_ALLOWED: Int

The usage of multiple SIM cards at the same time to register on the network (e.g. Dual Standby or Dual Active) is supported.

Value: 0

MULTISIM_NOT_SUPPORTED_BY_CARRIER

Added in API level 29
static val MULTISIM_NOT_SUPPORTED_BY_CARRIER: Int

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.

Value: 2

MULTISIM_NOT_SUPPORTED_BY_HARDWARE

Added in API level 29
static val MULTISIM_NOT_SUPPORTED_BY_HARDWARE: Int

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.

Value: 1

NETWORK_SELECTION_MODE_AUTO

Added in API level 30
static val NETWORK_SELECTION_MODE_AUTO: Int
Value: 1

NETWORK_SELECTION_MODE_MANUAL

Added in API level 30
static val NETWORK_SELECTION_MODE_MANUAL: Int
Value: 2

NETWORK_SELECTION_MODE_UNKNOWN

Added in API level 30
static val NETWORK_SELECTION_MODE_UNKNOWN: Int
Value: 0

NETWORK_TYPE_1xRTT

Added in API level 4
static val NETWORK_TYPE_1xRTT: Int

Current network is 1xRTT

Value: 7

NETWORK_TYPE_BITMASK_1xRTT

Added in API level 33
static val NETWORK_TYPE_BITMASK_1xRTT: Long

network type bitmask indicating the support of radio tech 1xRTT.

Value: 64L

NETWORK_TYPE_BITMASK_CDMA

Added in API level 33
static val NETWORK_TYPE_BITMASK_CDMA: Long

network type bitmask indicating the support of radio tech CDMA(IS95A/IS95B).

Value: 8L

NETWORK_TYPE_BITMASK_EDGE

Added in API level 33
static val NETWORK_TYPE_BITMASK_EDGE: Long

network type bitmask indicating the support of radio tech EDGE.

Value: 2L

NETWORK_TYPE_BITMASK_EHRPD

Added in API level 33
static val NETWORK_TYPE_BITMASK_EHRPD: Long

network type bitmask indicating the support of radio tech EHRPD.

Value: 8192L

NETWORK_TYPE_BITMASK_EVDO_0

Added in API level 33
static val NETWORK_TYPE_BITMASK_EVDO_0: Long

network type bitmask indicating the support of radio tech EVDO 0.

Value: 16L

NETWORK_TYPE_BITMASK_EVDO_A

Added in API level 33
static val NETWORK_TYPE_BITMASK_EVDO_A: Long

network type bitmask indicating the support of radio tech EVDO A.

Value: 32L

NETWORK_TYPE_BITMASK_EVDO_B

Added in API level 33
static val NETWORK_TYPE_BITMASK_EVDO_B: Long

network type bitmask indicating the support of radio tech EVDO B.

Value: 2048L

NETWORK_TYPE_BITMASK_GPRS

Added in API level 33
static val NETWORK_TYPE_BITMASK_GPRS: Long

network type bitmask indicating the support of radio tech GPRS.

Value: 1L

NETWORK_TYPE_BITMASK_GSM

Added in API level 33
static val NETWORK_TYPE_BITMASK_GSM: Long

network type bitmask indicating the support of radio tech GSM.

Value: 32768L

NETWORK_TYPE_BITMASK_HSDPA

Added in API level 33
static val NETWORK_TYPE_BITMASK_HSDPA: Long

network type bitmask indicating the support of radio tech HSDPA.

Value: 128L

NETWORK_TYPE_BITMASK_HSPA

Added in API level 33
static val NETWORK_TYPE_BITMASK_HSPA: Long

network type bitmask indicating the support of radio tech HSPA.

Value: 512L

NETWORK_TYPE_BITMASK_HSPAP

Added in API level 33
static val NETWORK_TYPE_BITMASK_HSPAP: Long

network type bitmask indicating the support of radio tech HSPAP.

Value: 16384L

NETWORK_TYPE_BITMASK_HSUPA

Added in API level 33
static val NETWORK_TYPE_BITMASK_HSUPA: Long

network type bitmask indicating the support of radio tech HSUPA.

Value: 256L

NETWORK_TYPE_BITMASK_IWLAN

Added in API level 33
static val NETWORK_TYPE_BITMASK_IWLAN: Long

network type bitmask indicating the support of radio tech IWLAN.

Value: 131072L

NETWORK_TYPE_BITMASK_LTE

Added in API level 33
static val NETWORK_TYPE_BITMASK_LTE: Long

network type bitmask indicating the support of radio tech LTE.

Value: 4096L

NETWORK_TYPE_BITMASK_LTE_CA

Added in API level 33
Deprecated in API level 34
static val NETWORK_TYPE_BITMASK_LTE_CA: Long

Deprecated: Please use NETWORK_TYPE_BITMASK_LTE instead. Deprecated in Android U.

NOT USED; this bitmask is exposed accidentally. If used, will be converted to NETWORK_TYPE_BITMASK_LTE. network type bitmask indicating the support of radio tech LTE CA (carrier aggregation).

Value: 262144L

NETWORK_TYPE_BITMASK_NR

Added in API level 33
static val NETWORK_TYPE_BITMASK_NR: Long

network type bitmask indicating the support of radio tech NR(New Radio) 5G.

Value: 524288L

NETWORK_TYPE_BITMASK_TD_SCDMA

Added in API level 33
static val NETWORK_TYPE_BITMASK_TD_SCDMA: Long

network type bitmask indicating the support of radio tech TD_SCDMA.

Value: 65536L

NETWORK_TYPE_BITMASK_UMTS

Added in API level 33
static val NETWORK_TYPE_BITMASK_UMTS: Long

network type bitmask indicating the support of radio tech UMTS.

Value: 4L

NETWORK_TYPE_BITMASK_UNKNOWN

Added in API level 33
static val NETWORK_TYPE_BITMASK_UNKNOWN: Long

network type bitmask unknown.

Value: 0L

NETWORK_TYPE_CDMA

Added in API level 4
static val NETWORK_TYPE_CDMA: Int

Current network is CDMA: Either IS95A or IS95B

Value: 4

NETWORK_TYPE_EDGE

Added in API level 1
static val NETWORK_TYPE_EDGE: Int

Current network is EDGE

Value: 2

NETWORK_TYPE_EHRPD

Added in API level 11
static val NETWORK_TYPE_EHRPD: Int

Current network is eHRPD

Value: 14

NETWORK_TYPE_EVDO_0

Added in API level 4
static val NETWORK_TYPE_EVDO_0: Int

Current network is EVDO revision 0

Value: 5

NETWORK_TYPE_EVDO_A

Added in API level 4
static val NETWORK_TYPE_EVDO_A: Int

Current network is EVDO revision A

Value: 6

NETWORK_TYPE_EVDO_B

Added in API level 9
static val NETWORK_TYPE_EVDO_B: Int

Current network is EVDO revision B

Value: 12

NETWORK_TYPE_GPRS

Added in API level 1
static val NETWORK_TYPE_GPRS: Int

Current network is GPRS

Value: 1

NETWORK_TYPE_GSM

Added in API level 25
static val NETWORK_TYPE_GSM: Int

Current network is GSM

Value: 16

NETWORK_TYPE_HSDPA

Added in API level 5
static val NETWORK_TYPE_HSDPA: Int

Current network is HSDPA

Value: 8

NETWORK_TYPE_HSPA

Added in API level 5
static val NETWORK_TYPE_HSPA: Int

Current network is HSPA

Value: 10

NETWORK_TYPE_HSPAP

Added in API level 13
static val NETWORK_TYPE_HSPAP: Int

Current network is HSPA+

Value: 15

NETWORK_TYPE_HSUPA

Added in API level 5
static val NETWORK_TYPE_HSUPA: Int

Current network is HSUPA

Value: 9

NETWORK_TYPE_IDEN

Added in API level 8
Deprecated in API level 34
static val NETWORK_TYPE_IDEN: Int

Deprecated: Legacy network type no longer being used starting in Android U.

Current network is iDen

Value: 11

NETWORK_TYPE_IWLAN

Added in API level 25
static val NETWORK_TYPE_IWLAN: Int

Current network is IWLAN

Value: 18

NETWORK_TYPE_LTE

Added in API level 11
static val NETWORK_TYPE_LTE: Int

Current network is LTE

Value: 13

NETWORK_TYPE_NR

Added in API level 29
static val NETWORK_TYPE_NR: Int

Current network is NR (New Radio) 5G. This will only be returned for 5G SA. For 5G NSA, the network type will be NETWORK_TYPE_LTE.

Value: 20

NETWORK_TYPE_TD_SCDMA

Added in API level 25
static val NETWORK_TYPE_TD_SCDMA: Int

Current network is TD_SCDMA

Value: 17

NETWORK_TYPE_UMTS

Added in API level 1
static val NETWORK_TYPE_UMTS: Int

Current network is UMTS

Value: 3

NETWORK_TYPE_UNKNOWN

Added in API level 1
static val NETWORK_TYPE_UNKNOWN: Int

Network type is unknown

Value: 0

PHONE_TYPE_CDMA

Added in API level 4
static val PHONE_TYPE_CDMA: Int

Phone radio is CDMA.

Value: 2

PHONE_TYPE_GSM

Added in API level 1
static val PHONE_TYPE_GSM: Int

Phone radio is GSM.

Value: 1

PHONE_TYPE_NONE

Added in API level 1
static val PHONE_TYPE_NONE: Int

No phone radio.

Value: 0

PHONE_TYPE_SIP

Added in API level 11
static val PHONE_TYPE_SIP: Int

Phone is via SIP.

Value: 3

PREMIUM_CAPABILITY_PRIORITIZE_LATENCY

Added in API level 34
static val PREMIUM_CAPABILITY_PRIORITIZE_LATENCY: Int

A premium capability that boosts the network to allow for real-time interactive traffic by prioritizing low latency communication. Corresponds to NetworkCapabilities#NET_CAPABILITY_PRIORITIZE_LATENCY.

Value: 34

PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS: Int

Purchase premium capability failed because a request was already made and is in progress. This may have been requested by either the same app or another app. Subsequent attempts will return the same error until the previous request completes.

Value: 4

PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED: Int

Purchase premium capability failed because it is already purchased and available. Subsequent attempts will return the same error until the performance boost expires.

Value: 3

PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED: Int

Purchase premium capability failed because the carrier disabled or does not support the capability, as specified in CarrierConfigManager#KEY_SUPPORTED_PREMIUM_CAPABILITIES_INT_ARRAY. Subsequent attempts will return the same error until the carrier enables the feature.

Value: 7

PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_ERROR

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_ERROR: Int

Purchase premium capability failed because the carrier app did not indicate success. Subsequent attempts will be throttled for the amount of time specified by KEY_PREMIUM_CAPABILITY_PURCHASE_CONDITION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG and return PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED.

Value: 8

PURCHASE_PREMIUM_CAPABILITY_RESULT_ENTITLEMENT_CHECK_FAILED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_ENTITLEMENT_CHECK_FAILED: Int

Purchase premium capability failed because the entitlement check failed. Subsequent attempts will be throttled for the amount of time specified by KEY_PREMIUM_CAPABILITY_PURCHASE_CONDITION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG and return PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED. Throttling will be reevaluated when the network is no longer congested.

Value: 13

PURCHASE_PREMIUM_CAPABILITY_RESULT_FEATURE_NOT_SUPPORTED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_FEATURE_NOT_SUPPORTED: Int

Purchase premium capability failed because the device does not support the feature. Subsequent attempts will return the same error.

Value: 10

PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_NOT_AVAILABLE

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_NOT_AVAILABLE: Int

Purchase premium capability failed because the network is not available. Subsequent attempts will return the same error until network conditions change.

Value: 12

PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUBSCRIPTION

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUBSCRIPTION: Int

Purchase premium capability failed because the request was not made on the default data subscription, indicated by SubscriptionManager#getDefaultDataSubscriptionId(). Subsequent attempts will return the same error until the request is made on the default data subscription.

Value: 14

PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND: Int

Purchase premium capability failed because the requesting application is not in the foreground. Subsequent attempts will return the same error until the requesting application moves to the foreground.

Value: 5

PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP: Int

Purchase premium capability was successful and is waiting for the network to setup the slicing configuration. If the setup is complete within the time specified by CarrierConfigManager#KEY_PREMIUM_CAPABILITY_NETWORK_SETUP_TIME_MILLIS_LONG, subsequent requests will return PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED until the purchase expires. If the setup is not complete within the time specified above, applications can request the premium capability again.

Value: 15

PURCHASE_PREMIUM_CAPABILITY_RESULT_REQUEST_FAILED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_REQUEST_FAILED: Int

Purchase premium capability failed because the telephony service is unavailable or there was an error in the phone process. Subsequent attempts will return the same error until request conditions are satisfied.

Value: 11

PURCHASE_PREMIUM_CAPABILITY_RESULT_SUCCESS

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_SUCCESS: Int

Purchase premium capability request was successful. Once the purchase result is successful, the network must set up a slicing configuration for the purchased premium capability within the timeout specified by CarrierConfigManager#KEY_PREMIUM_CAPABILITY_NETWORK_SETUP_TIME_MILLIS_LONG. During the setup time, subsequent attempts will return PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP. After setup is complete, subsequent attempts will return PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED until the boost expires. The expiry time is determined by the type or duration of boost purchased from the carrier, provided at CarrierConfigManager#KEY_PREMIUM_CAPABILITY_PURCHASE_URL_STRING.

Value: 1

PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED: Int

Purchase premium capability failed because the request is throttled. If purchasing premium capabilities is throttled, it will be for the amount of time specified by KEY_PREMIUM_CAPABILITY_PURCHASE_CONDITION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG. If displaying the performance boost notification is throttled, it will be for the amount of time specified by KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG. We will show the performance boost notification to the user up to the daily and monthly maximum number of times specified by CarrierConfigManager#KEY_PREMIUM_CAPABILITY_MAXIMUM_DAILY_NOTIFICATION_COUNT_INT and CarrierConfigManager#KEY_PREMIUM_CAPABILITY_MAXIMUM_MONTHLY_NOTIFICATION_COUNT_INT. Subsequent attempts will return the same error until the request is no longer throttled or throttling conditions change.

Value: 2

PURCHASE_PREMIUM_CAPABILITY_RESULT_TIMEOUT

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_TIMEOUT: Int

Purchase premium capability failed because we did not receive a response from the user for the performance boost notification within the time specified by CarrierConfigManager#KEY_PREMIUM_CAPABILITY_NOTIFICATION_DISPLAY_TIMEOUT_MILLIS_LONG. The performance boost notification will be automatically dismissed and subsequent attempts will be throttled for the amount of time specified by KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG and return PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED.

Value: 9

PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED

Added in API level 34
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED: Int

Purchase premium capability failed because the user canceled the operation. Subsequent attempts will be throttled for the amount of time specified by KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG and return PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED.

Value: 6

PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_DISABLED

Added in API level 35
static val PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_DISABLED: Int

Purchase premium capability failed because the user disabled the feature. Subsequent attempts will be throttled for the amount of time specified by KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG and return PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED.

Value: 16

SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION

Added in API level 29
static val SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION: Int

The subscription is not valid. It must be an active opportunistic subscription.

Value: 2

SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE

Added in API level 30
static val SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE: Int

The subscription is not valid. It must be an opportunistic subscription.

Value: 3

SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION

Added in API level 30
static val SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION: Int

Subscription service happened remote exception.

Value: 4

SET_OPPORTUNISTIC_SUB_SUCCESS

Added in API level 29
static val SET_OPPORTUNISTIC_SUB_SUCCESS: Int

No error. Operation succeeded.

Value: 0

SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED

Added in API level 29
static val SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED: Int

Validation failed when trying to switch to preferred subscription.

Value: 1

SIM_STATE_ABSENT

Added in API level 1
static val SIM_STATE_ABSENT: Int

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

Value: 1

SIM_STATE_CARD_IO_ERROR

Added in API level 26
static val SIM_STATE_CARD_IO_ERROR: Int

SIM card state: SIM Card Error, present but faulty

Value: 8

SIM_STATE_CARD_RESTRICTED

Added in API level 26
static val SIM_STATE_CARD_RESTRICTED: Int

SIM card state: SIM Card restricted, present but not usable due to carrier restrictions.

Value: 9

SIM_STATE_NETWORK_LOCKED

Added in API level 1
static val SIM_STATE_NETWORK_LOCKED: Int

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

Value: 4

SIM_STATE_NOT_READY

Added in API level 26
static val SIM_STATE_NOT_READY: Int

SIM card state: SIM Card is NOT READY

Value: 6

SIM_STATE_PERM_DISABLED

Added in API level 26
static val SIM_STATE_PERM_DISABLED: Int

SIM card state: SIM Card Error, permanently disabled

Value: 7

SIM_STATE_PIN_REQUIRED

Added in API level 1
static val SIM_STATE_PIN_REQUIRED: Int

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

Value: 2

SIM_STATE_PUK_REQUIRED

Added in API level 1
static val SIM_STATE_PUK_REQUIRED: Int

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

Value: 3

SIM_STATE_READY

Added in API level 1
static val SIM_STATE_READY: Int

SIM card state: Ready

Value: 5

SIM_STATE_UNKNOWN

Added in API level 1
static val SIM_STATE_UNKNOWN: Int

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.

Value: 0

UNINITIALIZED_CARD_ID

Added in API level 29
static val UNINITIALIZED_CARD_ID: Int

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.

Value: -2

UNKNOWN_CARRIER_ID

Added in API level 28
static val UNKNOWN_CARRIER_ID: Int

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.

Value: -1

UNSUPPORTED_CARD_ID

Added in API level 29
static val UNSUPPORTED_CARD_ID: Int

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.

Value: -1

UPDATE_AVAILABLE_NETWORKS_ABORTED

Added in API level 29
static val UPDATE_AVAILABLE_NETWORKS_ABORTED: Int

The request is aborted.

Value: 2

UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL

Added in API level 30
static val UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL: Int

Disable modem fail.

Value: 5

UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL

Added in API level 30
static val UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL: Int

Enable modem fail.

Value: 6

UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS

Added in API level 29
static val UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS: Int

The parameter passed in is invalid.

Value: 3

UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED

Added in API level 30
static val UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED: Int

Carrier app does not support multiple available networks.

Value: 7

UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE

Added in API level 29
static val UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE: Int

No carrier privilege.

Value: 4

UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE

Added in API level 30
static val UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE: Int

The subscription is not valid. It must be an opportunistic subscription.

Value: 8

UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION

Added in API level 30
static val UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION: Int

There is no OpportunisticNetworkService.

Value: 9

UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED

Added in API level 30
static val UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED: Int

OpportunisticNetworkService is disabled.

Value: 10

UPDATE_AVAILABLE_NETWORKS_SUCCESS

Added in API level 29
static val UPDATE_AVAILABLE_NETWORKS_SUCCESS: Int

No error. Operation succeeded.

Value: 0

UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE

Added in API level 29
static val UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE: Int

There is a unknown failure happened.

Value: 1

USSD_ERROR_SERVICE_UNAVAIL

Added in API level 26
static val USSD_ERROR_SERVICE_UNAVAIL: Int

Failure code returned when a USSD request has failed to execute because the Telephony service is unavailable.

Returned via TelephonyManager.UssdResponseCallback#onReceiveUssdResponseFailed(.

Value: -2

USSD_RETURN_FAILURE

Added in API level 26
static val USSD_RETURN_FAILURE: Int

Failed code returned when the mobile network has failed to complete a USSD request.

Returned via TelephonyManager.UssdResponseCallback#onReceiveUssdResponseFailed(.

Value: -1

VVM_TYPE_CVVM

Added in API level 23
static val VVM_TYPE_CVVM: String

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

Value: "vvm_type_cvvm"

VVM_TYPE_OMTP

Added in API level 23
static val VVM_TYPE_OMTP: String

The OMTP protocol.

Value: "vvm_type_omtp"

Public methods

canChangeDtmfToneLength

Added in API level 23
open fun canChangeDtmfToneLength(): Boolean

Whether the device supports configuring the DTMF tone length.
Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Boolean true if the DTMF tone length can be changed, and false otherwise.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

clearSignalStrengthUpdateRequest

Added in API level 31
open fun clearSignalStrengthUpdateRequest(request: SignalStrengthUpdateRequest): Unit

Clear a SignalStrengthUpdateRequest from the system.

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

If the given request was not set before, this operation is a no-op.
Requires android.Manifest.permission#MODIFY_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
request SignalStrengthUpdateRequest: the SignalStrengthUpdateRequest to be cleared from the System This value cannot be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

createForPhoneAccountHandle

Added in API level 26
open fun createForPhoneAccountHandle(phoneAccountHandle: PhoneAccountHandle!): TelephonyManager?

Create a new TelephonyManager object pinned to the subscription ID associated with the given phone account.

Return
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
open fun createForSubscriptionId(subId: Int): TelephonyManager!

Create a new TelephonyManager object pinned to the given subscription ID.

Return
TelephonyManager! a TelephonyManager that uses the given subId for all calls.

doesSwitchMultiSimConfigTriggerReboot

Added in API level 29
open fun doesSwitchMultiSimConfigTriggerReboot(): Boolean

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 android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Boolean true if reboot will be triggered after making changes to modem configurations, otherwise return false.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getActiveModemCount

Added in API level 30
open fun getActiveModemCount(): Int

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

getAllCellInfo

Added in API level 17
open fun getAllCellInfo(): MutableList<CellInfo!>!

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 android.telephony.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 android.Manifest.permission#ACCESS_FINE_LOCATION
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
MutableList<CellInfo!>! List of android.telephony.CellInfo; null if cell information is unavailable.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getAllowedNetworkTypesForReason

Added in API level 33
open fun getAllowedNetworkTypesForReason(reason: Int): Long

Get the allowed network types for certain reason. getAllowedNetworkTypesForReason returns allowed network type for a specific reason.

Requires permission: android.Manifest.READ_PRIVILEGED_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the TelephonyManager#CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK feature which can be detected using TelephonyManager.isRadioInterfaceCapabilitySupported(String).

Parameters
reason Int: the reason the allowed network type change is taking place Value is android.telephony.TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER, android.telephony.TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_POWER, android.telephony.TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER, or android.telephony.TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G
Return
Long the allowed network type bitmask Value is either 0 or a combination of android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_LTE_CA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_NR, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_IWLAN, and android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_IDEN
Exceptions
java.lang.IllegalStateException if the Telephony process is not currently available.
java.lang.IllegalArgumentException if invalid AllowedNetworkTypesReason is passed.
java.lang.SecurityException if the caller does not have the required permission/privileges
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getCallComposerStatus

Added in API level 31
open fun getCallComposerStatus(): Int

Get the user-set status for enriched calling with call composer.

If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int the user-set status for enriched calling with call composer, either of CALL_COMPOSER_STATUS_ON or CALL_COMPOSER_STATUS_OFF. Value is android.telephony.TelephonyManager#CALL_COMPOSER_STATUS_ON, android.telephony.TelephonyManager#CALL_COMPOSER_STATUS_OFF, or android.telephony.TelephonyManager#CALL_COMPOSER_STATUS_BUSINESS_ONLY
Exceptions
java.lang.SecurityException if the caller does not have the permission.
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

getCallState

Added in API level 1
Deprecated in API level 31
open fun getCallState(): Int

Deprecated: Use getCallStateForSubscription to retrieve the call state for a specific telephony subscription (which allows carrier privileged apps), TelephonyCallback.CallStateListener for real-time call state updates, or TelecomManager#isInCall(), which supplies an aggregate "in call" state for the entire device.

Returns the state of all calls on the device.

This method considers not only calls in the Telephony stack, but also calls via other android.telecom.ConnectionService implementations.

Note: The call state returned via this method may differ from what is reported by android.telephony.TelephonyCallback.CallStateListener#onCallStateChanged(int), as that callback only considers Telephony (mobile) calls.

Requires Permission: READ_PHONE_STATE for applications targeting API level 31+.

Return
Int the current call state. Value is android.telephony.TelephonyManager#CALL_STATE_IDLE, android.telephony.TelephonyManager#CALL_STATE_RINGING, or android.telephony.TelephonyManager#CALL_STATE_OFFHOOK

getCallStateForSubscription

Added in API level 31
open fun getCallStateForSubscription(): Int

Retrieve the call state for a specific subscription that was specified when this TelephonyManager instance was created.

Requires Permission: READ_PHONE_STATE or that the calling application has carrier privileges (see hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int The call state of the subscription associated with this TelephonyManager instance. Value is android.telephony.TelephonyManager#CALL_STATE_IDLE, android.telephony.TelephonyManager#CALL_STATE_RINGING, or android.telephony.TelephonyManager#CALL_STATE_OFFHOOK
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

getCardIdForDefaultEuicc

Added in API level 29
open fun getCardIdForDefaultEuicc(): Int

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.
Requires the PackageManager#FEATURE_TELEPHONY_EUICC feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int card ID of the default eUICC card, if loaded.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_EUICC.

getCarrierConfig

Added in API level 26
open fun getCarrierConfig(): PersistableBundle!

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 android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getCarrierIdFromSimMccMnc

Added in API level 29
open fun getCarrierIdFromSimMccMnc(): Int

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.
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int matching carrier id from sim MCCMNC. Return UNKNOWN_CARRIER_ID if the subscription is unavailable or the carrier cannot be identified.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getCarrierRestrictionStatus

Added in API level 34
open fun getCarrierRestrictionStatus(
    executor: Executor,
    resultListener: Consumer<Int!>
): Unit

Get the carrier restriction status of the device.

To fetch the carrier restriction status of the device the calling application needs to be allowlisted to Android at here. The calling application also needs the READ_PHONE_STATE permission. The return value of the API is as follows.


Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).
Requires android.Manifest.permission#READ_PHONE_STATE
Parameters
executor Executor: The executor on which the result listener will be called. This value cannot be null.
resultListener Consumer<Int!>: Consumer that will be called with the carrier restriction status result fetched from the radio This value cannot be null. Value is android.telephony.TelephonyManager#CARRIER_RESTRICTION_STATUS_UNKNOWN, android.telephony.TelephonyManager#CARRIER_RESTRICTION_STATUS_NOT_RESTRICTED, android.telephony.TelephonyManager#CARRIER_RESTRICTION_STATUS_RESTRICTED, or android.telephony.TelephonyManager#CARRIER_RESTRICTION_STATUS_RESTRICTED_TO_CALLER
Exceptions
java.lang.SecurityException if the caller does not have the required permission/privileges or if the caller is not pre-registered.
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getCellLocation

Added in API level 1
Deprecated in API level 26
open fun getCellLocation(): CellLocation!

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 android.Manifest.permission#ACCESS_FINE_LOCATION
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
CellLocation! Current location of the device or null if not available.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getDataActivity

Added in API level 1
open fun getDataActivity(): Int

Returns a constant indicating the type of activity on a data connection (cellular).
Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

getDataNetworkType

Added in API level 24
open fun getDataNetworkType(): Int

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, applies to the given subId. Otherwise, applies to SubscriptionManager#getActiveDataSubscriptionId(). Note: Before SubscriptionManager#getActiveDataSubscriptionId() was introduced in API level 30, it was applied to SubscriptionManager#getDefaultDataSubscriptionId() which may be different now from SubscriptionManager#getActiveDataSubscriptionId(), e.g. when opportunistic network is providing cellular internet connection to the user.

Requires Permission: READ_PHONE_STATE or READ_BASIC_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int the network type Value is android.telephony.TelephonyManager#NETWORK_TYPE_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_IDEN, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_IWLAN, or android.telephony.TelephonyManager#NETWORK_TYPE_NR
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getDataState

Added in API level 1
open fun getDataState(): Int

Returns a constant indicating the current data connection state (cellular).
Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

getDeviceId

Added in API level 1
Deprecated in API level 26
open fun getDeviceId(): String!

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:

If the calling app does not meet one of these requirements then this method will behave as follows:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE

getDeviceId

Added in API level 23
Deprecated in API level 26
open fun getDeviceId(slotIndex: Int): String!

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:

If the calling app does not meet one of these requirements then this method will behave as follows:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Parameters
slotIndex Int: of which deviceID is returned

getDeviceSoftwareVersion

Added in API level 1
open fun getDeviceSoftwareVersion(): String?

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 android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY.

getEmergencyNumberList

Added in API level 29
open fun getEmergencyNumberList(): MutableMap<Int!, MutableList<EmergencyNumber!>!>

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 android.Manifest.permission#READ_PHONE_STATE or the calling app has carrier privileges (see hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

Return
MutableMap<Int!, MutableList<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.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

getEmergencyNumberList

Added in API level 29
open fun getEmergencyNumberList(categories: Int): MutableMap<Int!, MutableList<EmergencyNumber!>!>

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 android.Manifest.permission#READ_PHONE_STATE or the calling app has carrier privileges (see hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
categories Int: the emergency service categories which are the bitwise-OR combination of the following constants:
  1. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED
  2. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_POLICE
  3. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AMBULANCE
  4. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE
  5. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD
  6. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE
  7. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MIEC
  8. EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AIEC
Value is either 0 or a combination of android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_POLICE, android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AMBULANCE, android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE, android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD, android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE, android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MIEC, and android.telephony.emergency.EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AIEC
Return
MutableMap<Int!, MutableList<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.
Exceptions
java.lang.IllegalStateException if the Telephony process is not currently available.
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

getEquivalentHomePlmns

Added in API level 31
open fun getEquivalentHomePlmns(): MutableList<String!>

Returns a list of the equivalent home PLMNs (EF_EHPLMN) from the USIM app.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
MutableList<String!> A list of equivalent home PLMNs. Returns an empty list if EF_EHPLMN is empty or does not exist on the SIM card. This value cannot be null.
Exceptions
java.lang.IllegalStateException if the Telephony process is not currently available.
java.lang.SecurityException if the caller doesn't have the permission.
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getForbiddenPlmns

Added in API level 26
open fun getForbiddenPlmns(): Array<String!>!

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 android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Array<String!>! an array of forbidden PLMNs or null if not available
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getGroupIdLevel1

Added in API level 18
open fun getGroupIdLevel1(): String!

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 android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getIccAuthentication

Added in API level 24
open fun getIccAuthentication(
    appType: Int,
    authType: Int,
    data: String!
): String!

Returns the response of authentication for the default subscription. Returns null if the authentication hasn't been successful

Requires one of the following permissions:


Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
appType Int: the icc application type, like APPTYPE_USIM
authType Int: the authentication type, any one of AUTHTYPE_EAP_AKA or AUTHTYPE_EAP_SIM or AUTHTYPE_GBA_BOOTSTRAP or AUTHTYPE_GBA_NAF_KEY_EXTERNAL Value is android.telephony.TelephonyManager#AUTHTYPE_EAP_SIM, android.telephony.TelephonyManager#AUTHTYPE_EAP_AKA, android.telephony.TelephonyManager#AUTHTYPE_GBA_BOOTSTRAP, or android.telephony.TelephonyManager#AUTHTYPE_GBA_NAF_KEY_EXTERNAL
data String!: authentication challenge data, base64 encoded. See 3GPP TS 31.102 7.1.2 for more details.
Return
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
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getImei

Added in API level 26
open fun getImei(): String!

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
Requires the PackageManager#FEATURE_TELEPHONY_GSM feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_GSM.

getImei

Added in API level 26
open fun getImei(slotIndex: Int): String!

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:

If the calling app does not meet one of these requirements then this method will behave as follows:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_GSM feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
slotIndex Int: of which IMEI is returned
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_GSM.

getLine1Number

Added in API level 1
Deprecated in API level 33
open fun getLine1Number(): String!

Deprecated: use SubscriptionManager#getPhoneNumber(int) instead.

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 android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#READ_SMS or android.Manifest.permission#READ_PHONE_NUMBERS
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getManualNetworkSelectionPlmn

Added in API level 30
open fun getManualNetworkSelectionPlmn(): String

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 android.Manifest.permission#READ_PRECISE_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
String manually selected network info on success or empty string on failure This value cannot be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getManufacturerCode

Added in API level 29
open fun getManufacturerCode(): String?

Returns the Manufacturer Code from the MEID. Return null if Manufacturer Code is not available.
Requires the PackageManager#FEATURE_TELEPHONY_CDMA feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CDMA.

getManufacturerCode

Added in API level 29
open fun getManufacturerCode(slotIndex: Int): String?

Returns the Manufacturer Code from the MEID. Return null if Manufacturer Code is not available.
Requires the PackageManager#FEATURE_TELEPHONY_CDMA feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
slotIndex Int: of which Type Allocation Code is returned
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CDMA.

getMaximumCallComposerPictureSize

Added in API level 31
open static fun getMaximumCallComposerPictureSize(): Long

Indicates the maximum size of the call composure picture. Pictures sent via uploadCallComposerPicture(java.io.InputStream,java.lang.String,java.util.concurrent.Executor,android.os.OutcomeReceiver) or uploadCallComposerPicture(java.nio.file.Path,java.lang.String,java.util.concurrent.Executor,android.os.OutcomeReceiver) must not exceed this size, or an error will be returned via the callback in those methods.
Value is a non-negative number of bytes.

Return
Long Maximum file size in bytes. Value is a non-negative number of bytes.

getMeid

Added in API level 26
open fun getMeid(): String!

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:

If the calling app does not meet one of these requirements then this method will behave as follows:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CDMA feature which can be detected using PackageManager.hasSystemFeature(String).
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CDMA.

getMeid

Added in API level 26
open fun getMeid(slotIndex: Int): String!

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:

If the calling app does not meet one of these requirements then this method will behave as follows:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CDMA feature which can be detected using PackageManager.hasSystemFeature(String).
Parameters
slotIndex Int: of which MEID is returned
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CDMA.

getMmsUAProfUrl

Added in API level 19
open fun getMmsUAProfUrl(): String!

Returns the MMS user agent profile URL.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getMmsUserAgent

Added in API level 19
open fun getMmsUserAgent(): String!

Returns the MMS user agent.
Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_MESSAGING.

getNai

Added in API level 28
open fun getNai(): String!

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:

If the calling app does not meet one of these requirements then this method will behave as follows:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getNetworkCountryIso

Added in API level 1
open fun getNetworkCountryIso(): String!

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


Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
String! the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string if not available.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getNetworkCountryIso

Added in API level 30
open fun getNetworkCountryIso(slotIndex: Int): String

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


Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
slotIndex Int: the SIM slot index to get network country ISO.
Return
String the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string if not available. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException when the slotIndex is invalid.
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getNetworkOperator

Added in API level 1
open fun getNetworkOperator(): String!

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).
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

getNetworkOperatorName

Added in API level 1
open fun getNetworkOperatorName(): String!

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).
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

getNetworkSelectionMode

Added in API level 30
open fun getNetworkSelectionMode(): Int

Get the network selection mode.

If this object has been created with createForSubscriptionId, 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 android.Manifest.permission#READ_PRECISE_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int the network selection mode. Value is android.telephony.TelephonyManager#NETWORK_SELECTION_MODE_UNKNOWN, android.telephony.TelephonyManager#NETWORK_SELECTION_MODE_AUTO, or android.telephony.TelephonyManager#NETWORK_SELECTION_MODE_MANUAL
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getNetworkSlicingConfiguration

Added in API level 31
open fun getNetworkSlicingConfiguration(
    executor: Executor,
    callback: OutcomeReceiver<NetworkSlicingConfig!, TelephonyManager.NetworkSlicingException!>
): Unit

Request to get the current slicing configuration including URSP rules and NSSAIs (configured, allowed and rejected). This method can be invoked if one of the following requirements is met:

  • If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this is a privileged permission that can only be granted to apps preloaded on the device.
  • If the calling app has carrier privileges (see hasCarrierPrivileges).
This will be invalid if the device does not support android.telephony.TelephonyManager#CAPABILITY_SLICING_CONFIG_SUPPORTED.
Requires the TelephonyManager#CAPABILITY_SLICING_CONFIG_SUPPORTED feature which can be detected using TelephonyManager.isRadioInterfaceCapabilitySupported(String).
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE

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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback OutcomeReceiver<NetworkSlicingConfig!, TelephonyManager.NetworkSlicingException!>: a callback to receive the current slicing configuration. This value cannot be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getNetworkSpecifier

Added in API level 26
open fun getNetworkSpecifier(): String!

Returns the network specifier of the subscription ID pinned to the TelephonyManager. The network specifier is used by android.net.NetworkRequest.Builder#setNetworkSpecifier(String) to create a that connects through the subscription.
Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

getNetworkType

Added in API level 1
Deprecated in API level 30
open fun getNetworkType(): Int

Deprecated: use getDataNetworkType()

Return the current data network type.
Requires android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int the NETWORK_TYPE_xxxx for current data connection. Value is android.telephony.TelephonyManager#NETWORK_TYPE_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_IDEN, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_IWLAN, or android.telephony.TelephonyManager#NETWORK_TYPE_NR
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getPhoneAccountHandle

Added in API level 31
open fun getPhoneAccountHandle(): PhoneAccountHandle?

Determines the PhoneAccountHandle associated with this TelephonyManager.

If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()

Requires Permission android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges)
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

Return
PhoneAccountHandle? The PhoneAccountHandle associated with the TelphonyManager, or null if there is no associated PhoneAccountHandle; this can happen if the subscription is data-only or an opportunistic subscription.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

getPhoneCount

Added in API level 23
Deprecated in API level 30
open fun getPhoneCount(): Int

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

getPhoneType

Added in API level 1
open fun getPhoneType(): Int

Returns a constant indicating the device phone type. This indicates the type of radio used to transmit voice calls.
Requires the PackageManager#FEATURE_TELEPHONY feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY.

getPreferredOpportunisticDataSubscription

Added in API level 29
open fun getPreferredOpportunisticDataSubscription(): Int

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 android.Manifest.permission#READ_PHONE_STATE
Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int subId preferred opportunistic subscription id or SubscriptionManager#DEFAULT_SUBSCRIPTION_ID if there are no preferred subscription id
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

getPrimaryImei

Added in API level 34
open fun getPrimaryImei(): String

Returns the primary IMEI (International Mobile Equipment Identity) of the device as mentioned in GSMA TS.37. getImei(int) returns the IMEI that belongs to the selected slotID whereas this API getPrimaryImei() returns primary IMEI of the device. A single SIM device with only one IMEI will be set by default as primary IMEI. A multi-SIM device with multiple IMEIs will have one of the IMEIs set as primary as mentioned in GSMA TS37_2.2_REQ_8.

Requires one of the following permissions


Requires the PackageManager#FEATURE_TELEPHONY_GSM feature which can be detected using PackageManager.hasSystemFeature(String).
Return
String Primary IMEI of type string This value cannot be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_GSM.
java.lang.SecurityException if the caller does not have the required permission/privileges

getServiceState

Added in API level 26
open fun getServiceState(): ServiceState?

Returns the current ServiceState information.

If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId() If you want continuous updates of service state info, register a TelephonyCallback that implements TelephonyCallback.ServiceStateListener through #registerTelephonyCallback.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges) and android.Manifest.permission#ACCESS_COARSE_LOCATION. May return null when the subscription is inactive or when there was an error communicating with the phone process.
Requires android.Manifest.permission#READ_PHONE_STATE and android.Manifest.permission#ACCESS_COARSE_LOCATION
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getServiceState

Added in API level 33
open fun getServiceState(includeLocationData: Int): ServiceState?

Returns the current ServiceState information.

If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId() If you want continuous updates of service state info, register a TelephonyCallback that implements TelephonyCallback.ServiceStateListener through #registerTelephonyCallback. There's another way to renounce permissions with a custom context AttributionSource.Builder#setRenouncedPermissions(Set<String>) but only for system apps. To avoid confusion, calling this method supersede renouncing permissions with a custom context.

Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges) and android.Manifest.permission#ACCESS_COARSE_LOCATION.
Requires android.Manifest.permission#READ_PHONE_STATE and android.Manifest.permission#ACCESS_COARSE_LOCATION
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Parameters
includeLocationData Int: Specifies if the caller would like to receive location related information. May return null when the subscription is inactive or when there was an error communicating with the phone process. Value is android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_NONE, android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_COARSE, or android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_FINE
Return
ServiceState? This value may be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getSignalStrength

Added in API level 28
open fun getSignalStrength(): SignalStrength?

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.
Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

Return
SignalStrength? the most recent cached signal strength info from the modem This value may be null.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

getSimCarrierId

Added in API level 28
open fun getSimCarrierId(): Int

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.
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
Int Carrier id of the current subscription. Return UNKNOWN_CARRIER_ID if the subscription is unavailable or the carrier cannot be identified.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getSimCarrierIdName

Added in API level 28
open fun getSimCarrierIdName(): CharSequence?

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.
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
CharSequence? Carrier name of the current subscription. Return null if the subscription is unavailable or the carrier cannot be identified.
Exceptions
java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

getSimCountryIso

Added in API level 1
open fun getSimCountryIso(): String!

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.
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

Return
String! the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string is not available.

getSimOperator

Added in API level 1
open fun getSimOperator(): String!

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
Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

See Also

    getSimOperatorName

    Added in API level 1
    open fun getSimOperatorName(): String!

    Returns the Service Provider Name (SPN).

    Availability: SIM state must be SIM_STATE_READY
    Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

    See Also

      getSimSerialNumber

      Added in API level 1
      open fun getSimSerialNumber(): String!

      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:

      If the calling app does not meet one of these requirements then this method will behave as follows:

      • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
      • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

      Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      getSimSpecificCarrierId

      Added in API level 29
      open fun getSimSpecificCarrierId(): Int

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      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.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      getSimSpecificCarrierIdName

      Added in API level 29
      open fun getSimSpecificCarrierIdName(): CharSequence?

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      CharSequence? user-facing name of the subscription specific carrier id. Return null if the subscription is unavailable or the carrier cannot be identified.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      getSubscriberId

      Added in API level 1
      open fun getSubscriberId(): String!

      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:

      If the calling app does not meet one of these requirements then this method will behave as follows:

      • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then null is returned.
      • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

      Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      getSubscriptionId

      Added in API level 30
      open fun getSubscriptionId(): Int

      Return an appropriate subscription ID for any situation. If this object has been created with createForSubscriptionId, then the provided subscription ID is returned. Otherwise, the default subscription ID will be returned.
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      getSubscriptionId

      Added in API level 30
      open fun getSubscriptionId(phoneAccountHandle: PhoneAccountHandle): Int

      Returns the subscription ID for the given phone account handle.
      Requires android.Manifest.permission#READ_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      phoneAccountHandle PhoneAccountHandle: the phone account handle for outgoing calls This value cannot be null.
      Return
      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.

      getSupportedModemCount

      Added in API level 30
      open fun getSupportedModemCount(): Int

      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.

      getSupportedRadioAccessFamily

      Added in API level 33
      open fun getSupportedRadioAccessFamily(): Long


      Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Long Modem supported radio access family bitmask

      Requires permission: android.Manifest.READ_PRIVILEGED_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges). Value is either 0 or a combination of android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_LTE_CA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_NR, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_IWLAN, and android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_IDEN

      Exceptions
      java.lang.SecurityException if the caller does not have the required permission
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      getTypeAllocationCode

      Added in API level 29
      open fun getTypeAllocationCode(): String?

      Returns the Type Allocation Code from the IMEI. Return null if Type Allocation Code is not available.
      Requires the PackageManager#FEATURE_TELEPHONY_GSM feature which can be detected using PackageManager.hasSystemFeature(String).

      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_GSM.

      getTypeAllocationCode

      Added in API level 29
      open fun getTypeAllocationCode(slotIndex: Int): String?

      Returns the Type Allocation Code from the IMEI. Return null if Type Allocation Code is not available.
      Requires the PackageManager#FEATURE_TELEPHONY_GSM feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      slotIndex Int: of which Type Allocation Code is returned
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_GSM.

      getUiccCardsInfo

      Added in API level 29
      open fun getUiccCardsInfo(): MutableList<UiccCardInfo!>

      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 physical slot index where the card is inserted (UiccCardInfo#getPhysicalSlotIndex().

      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
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      MutableList<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.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      getVisualVoicemailPackageName

      Added in API level 26
      open fun getVisualVoicemailPackageName(): String?

      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 android.Manifest.permission#READ_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      getVoiceMailAlphaTag

      Added in API level 1
      open fun getVoiceMailAlphaTag(): String!

      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 android.Manifest.permission#READ_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      getVoiceMailNumber

      Added in API level 1
      open fun getVoiceMailNumber(): String!

      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 android.Manifest.permission#READ_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      getVoiceNetworkType

      Added in API level 24
      open fun getVoiceNetworkType(): Int

      Returns the NETWORK_TYPE_xxxx for voice

      Requires Permission: READ_PHONE_STATE or READ_BASIC_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Int Value is android.telephony.TelephonyManager#NETWORK_TYPE_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_IDEN, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_IWLAN, or android.telephony.TelephonyManager#NETWORK_TYPE_NR
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      getVoicemailRingtoneUri

      Added in API level 24
      open fun getVoicemailRingtoneUri(accountHandle: PhoneAccountHandle!): Uri?

      Returns the URI for the per-account voicemail ringtone set in Phone settings.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      accountHandle PhoneAccountHandle!: The handle for the PhoneAccount for which to retrieve the voicemail ringtone.
      Return
      Uri? The URI for the ringtone to play when receiving a voicemail from a specific PhoneAccount. May be null if no ringtone is set.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      hasCarrierPrivileges

      Added in API level 22
      open fun hasCarrierPrivileges(): Boolean

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the app has carrier privileges.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      hasIccCard

      Added in API level 5
      open fun hasIccCard(): Boolean

      This API is used to check if there is an ICC card present in the device. An ICC card is a smart card that contains a subscriber identity module (SIM) and is used to identify and authenticate users to a mobile network. Note: In case of embedded SIM there is an ICC card always present irrespective of whether an active SIM profile is present or not so this API would always return true.
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if a ICC card is present.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      iccCloseLogicalChannel

      Added in API level 21
      open fun iccCloseLogicalChannel(channel: Int): Boolean

      Closes a previously opened logical channel to the ICC card. Input parameters equivalent to TS 27.007 AT+CCHC command. It is strongly recommended that callers of this API should firstly create new TelephonyManager instance by calling TelephonyManager#createForSubscriptionId(int). Failure to do so can result in unpredictable and detrimental behavior like callers can end up talking to the wrong SIM card.

      Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      channel Int: is the channel id to be closed as returned by a successful iccOpenLogicalChannel.
      Return
      Boolean true if the channel was closed successfully.
      Exceptions
      java.lang.IllegalArgumentException if input parameters are wrong. e.g., invalid channel
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      iccExchangeSimIO

      Added in API level 21
      open fun iccExchangeSimIO(
          fileID: Int,
          command: Int,
          p1: Int,
          p2: Int,
          p3: Int,
          filePath: String!
      ): ByteArray!

      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).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      fileID Int:
      command Int:
      p1 Int: P1 value of the APDU command.
      p2 Int: P2 value of the APDU command.
      p3 Int: P3 value of the APDU command.
      filePath String!:
      Return
      ByteArray! The APDU response.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      iccOpenLogicalChannel

      Added in API level 21
      Deprecated in API level 26
      open fun iccOpenLogicalChannel(AID: String!): IccOpenLogicalChannelResponse!

      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).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      AID String!: Application id. See ETSI 102.221 and 101.220.
      Return
      IccOpenLogicalChannelResponse! an IccOpenLogicalChannelResponse object.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      iccOpenLogicalChannel

      Added in API level 26
      open fun iccOpenLogicalChannel(
          AID: String!,
          p2: Int
      ): IccOpenLogicalChannelResponse!

      Opens a logical channel to the ICC card. This operation wraps two APDU instructions:

      • MANAGE CHANNEL to open a logical channel
      • SELECT the given AID using the given p2
      Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08, and 0x0C are guaranteed to be supported. If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be considered an error and the channel shall not be opened. Input parameters equivalent to TS 27.007 AT+CCHO command. It is strongly recommended that callers of this should firstly create a new TelephonyManager instance by calling TelephonyManager#createForSubscriptionId(int). Failure to do so can result in unpredictable and detrimental behavior like callers can end up talking to the wrong SIM card.

      Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      AID String!: Application id. See ETSI 102.221 and 101.220.
      p2 Int: P2 parameter (described in ISO 7816-4).
      Return
      IccOpenLogicalChannelResponse! an IccOpenLogicalChannelResponse object.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      iccTransmitApduBasicChannel

      Added in API level 21
      open fun iccTransmitApduBasicChannel(
          cla: Int,
          instruction: Int,
          p1: Int,
          p2: Int,
          p3: Int,
          data: String!
      ): String!

      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).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      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.
      Return
      String! The APDU response from the ICC card with the status appended at the end.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      iccTransmitApduLogicalChannel

      Added in API level 21
      open fun iccTransmitApduLogicalChannel(
          channel: Int,
          cla: Int,
          instruction: Int,
          p1: Int,
          p2: Int,
          p3: Int,
          data: String!
      ): String!

      Transmit an APDU to the ICC card over a logical channel. Input parameters equivalent to TS 27.007 AT+CGLA command. It is strongly recommended that callers of this API should firstly create a new TelephonyManager instance by calling TelephonyManager#createForSubscriptionId(int). Failure to do so can result in unpredictable and detrimental behavior like callers can end up talking to the wrong SIM card.

      Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      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.
      Return
      String! The APDU response from the ICC card with the status appended at the end.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      isConcurrentVoiceAndDataSupported

      Added in API level 26
      open fun isConcurrentVoiceAndDataSupported(): Boolean

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if simultaneous voice and data supported, and false otherwise.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      isDataCapable

      Added in API level 31
      open fun isDataCapable(): Boolean


      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the current device is "data capable" over a radio on the device.

      "Data capable" means that this device supports packet-switched data connections over the telephony network.

      isDataConnectionAllowed

      Added in API level 31
      open fun isDataConnectionAllowed(): Boolean

      Checks whether cellular data connection is allowed in the device.

      Whether cellular data connection is allowed considers all factors below:

      • User turned on data setting isDataEnabled.
      • Carrier allows data to be on.
      • Network policy.
      • And possibly others.

      Requires android.Manifest.permission#ACCESS_NETWORK_STATE or android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).
      Return
      Boolean true if the overall data connection is allowed; false if not.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      isDataEnabled

      Added in API level 26
      open fun isDataEnabled(): Boolean

      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, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()

      Requires one of the following permissions: android.Manifest.permission#ACCESS_NETWORK_STATE, android.Manifest.permission#MODIFY_PHONE_STATE, or READ_BASIC_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 android.Manifest.permission#ACCESS_NETWORK_STATE or android.Manifest.permission#MODIFY_PHONE_STATE or android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if mobile data is enabled.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      isDataEnabledForReason

      Added in API level 31
      open fun isDataEnabledForReason(reason: Int): Boolean

      Return whether data is enabled for certain reason . If isDataEnabledForReason returns false, it means in data enablement for a specific reason is turned off. If any of the reason is off, then it will result in bypassing user preference and result in data to be turned off. Call isDataConnectionAllowed in order to know whether data connection is allowed on the device.

      If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()
      Requires android.Manifest.permission#ACCESS_NETWORK_STATE or android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#MODIFY_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      reason Int: the reason the data enable change is taking place Value is android.telephony.TelephonyManager#DATA_ENABLED_REASON_USER, android.telephony.TelephonyManager#DATA_ENABLED_REASON_POLICY, android.telephony.TelephonyManager#DATA_ENABLED_REASON_CARRIER, or android.telephony.TelephonyManager#DATA_ENABLED_REASON_THERMAL
      Return
      Boolean whether data is enabled for a reason.

      Requires Permission: The calling app has carrier privileges (see hasCarrierPrivileges) or READ_PHONE_STATE or android.Manifest.permission#ACCESS_NETWORK_STATE or android.Manifest.permission#MODIFY_PHONE_STATE android.Manifest.permission#READ_BASIC_PHONE_STATE

      Exceptions
      java.lang.IllegalStateException if the Telephony process is not currently available.
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      isDataRoamingEnabled

      Added in API level 29
      open fun isDataRoamingEnabled(): Boolean

      Returns whether mobile data roaming is enabled on the subscription.

      If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()

      Requires one of the following permissions: android.Manifest.permission#ACCESS_NETWORK_STATE, android.Manifest.permission#READ_PHONE_STATE or READ_BASIC_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires android.Manifest.permission#ACCESS_NETWORK_STATE or android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission#READ_BASIC_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the data roaming is enabled on the subscription, otherwise return
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA. false.

      isDeviceSmsCapable

      Added in API level 35
      open fun isDeviceSmsCapable(): Boolean


      Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

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

      Starting from Android 15, SMS capability may also be overridden by carriers for a given subscription on an SMS capable device. To check if a subscription is "SMS capable", call method SubscriptionInfo#getServiceCapabilities() and check if SubscriptionManager#SERVICE_CAPABILITY_SMS is included.

      isDeviceVoiceCapable

      Added in API level 35
      open fun isDeviceVoiceCapable(): Boolean


      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the current device is "voice capable".

      "Voice capable" means that this device supports circuit-switched or IMS packet 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.

      Starting from Android 15, voice capability may also be overridden by carrier for a given subscription on a voice capable device. To check if a subscription is "voice capable", call method SubscriptionInfo#getServiceCapabilities() and check if SubscriptionManager#SERVICE_CAPABILITY_VOICE is included.

      isEmergencyNumber

      Added in API level 29
      open fun isEmergencyNumber(number: String): Boolean

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      number String: - the number to look up This value cannot be null.
      Return
      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.
      Exceptions
      java.lang.IllegalStateException if the Telephony process is not currently available.
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      isHearingAidCompatibilitySupported

      Added in API level 23
      open fun isHearingAidCompatibilitySupported(): Boolean

      Whether the phone supports hearing aid compatibility.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the device supports hearing aid compatibility, and false otherwise.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      isManualNetworkSelectionAllowed

      Added in API level 30
      open fun isManualNetworkSelectionAllowed(): Boolean

      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, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId().
      Requires android.Manifest.permission#READ_PRECISE_PHONE_STATE or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if manual network selection is allowed, otherwise return false.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      isModemEnabledForSlot

      Added in API level 30
      open fun isModemEnabledForSlot(slotIndex: Int): Boolean

      Indicates whether or not there is a modem stack enabled for the given SIM slot.

      Requires Permission: READ_PHONE_STATE, READ_PRIVILEGED_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges()).
      Requires android.Manifest.permission#READ_PHONE_STATE or android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      slotIndex Int: which slot it's checking.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY.

      isMultiSimSupported

      Added in API level 29
      open fun isMultiSimSupported(): Int

      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 android.Manifest.permission#READ_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      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 android.telephony.TelephonyManager#MULTISIM_ALLOWED, android.telephony.TelephonyManager#MULTISIM_NOT_SUPPORTED_BY_HARDWARE, or android.telephony.TelephonyManager#MULTISIM_NOT_SUPPORTED_BY_CARRIER
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      isNetworkRoaming

      Added in API level 1
      open fun isNetworkRoaming(): Boolean

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

      Availability: Only when user registered to a network.
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      isPremiumCapabilityAvailableForPurchase

      Added in API level 34
      open fun isPremiumCapabilityAvailableForPurchase(capability: Int): Boolean

      Check whether the given premium capability is available for purchase from the carrier. If this is true, the capability can be purchased from the carrier using purchasePremiumCapability(int,java.util.concurrent.Executor,java.util.function.Consumer).
      Requires android.Manifest.permission#READ_BASIC_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      capability Int: The premium capability to check. Value is android.telephony.TelephonyManager#PREMIUM_CAPABILITY_PRIORITIZE_LATENCY
      Return
      Boolean Whether the given premium capability is available to purchase.
      Exceptions
      java.lang.SecurityException if the caller does not hold permission READ_BASIC_PHONE_STATE.
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      isRadioInterfaceCapabilitySupported

      Added in API level 31
      open fun isRadioInterfaceCapabilitySupported(capability: String): Boolean

      Whether the device supports a given capability on the radio interface. If the capability is not in the set of radio interface capabilities, false is returned.
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      capability String: the name of the capability to check for This value cannot be null. Value is android.telephony.TelephonyManager#CAPABILITY_SLICING_CONFIG_SUPPORTED, or android.telephony.TelephonyManager.CAPABILITY_SIM_PHONEBOOK_IN_MODEM
      Return
      Boolean the availability of the capability
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      isRttSupported

      Added in API level 29
      open fun isRttSupported(): Boolean

      Determines whether the device currently supports RTT (Real-time text). Based both on carrier support for the feature and device firmware support.
      Requires the PackageManager#FEATURE_TELEPHONY_IMS feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the device and carrier both support RTT, false otherwise.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_IMS.

      isSmsCapable

      Added in API level 21
      Deprecated in API level 35
      open fun isSmsCapable(): Boolean

      Deprecated: Replaced by isDeviceSmsCapable(). Starting from Android 15, SMS capability may also be overridden by carriers for a given subscription. For SMS capable device (when isDeviceSmsCapable return true), caller should check for subscription-level SMS capability as well. See isDeviceSmsCapable for details.


      Requires the PackageManager#FEATURE_TELEPHONY_MESSAGING feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      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
      Deprecated in API level 28
      open fun isTtyModeSupported(): Boolean

      Deprecated: Use TelecomManager#isTtySupported() instead Whether the phone supports TTY mode.

      Return
      Boolean true if the device supports TTY mode, and false otherwise.

      isVoiceCapable

      Added in API level 22
      Deprecated in API level 35
      open fun isVoiceCapable(): Boolean

      Deprecated: Replaced by isDeviceVoiceCapable(). Starting from Android 15, voice capability may also be overridden by carriers for a given subscription. For voice capable device (when isDeviceVoiceCapable return true), caller should check for subscription-level voice capability as well. See isDeviceVoiceCapable for details.


      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      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
      open fun isVoicemailVibrationEnabled(accountHandle: PhoneAccountHandle!): Boolean

      Returns whether vibration is set for voicemail notification in Phone settings.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      accountHandle PhoneAccountHandle!: The handle for the PhoneAccount for which to retrieve the voicemail vibration setting.
      Return
      Boolean true if the vibration is set for this PhoneAccount, false otherwise.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      isWorldPhone

      Added in API level 23
      open fun isWorldPhone(): Boolean

      Whether the device is a world phone.
      Requires the PackageManager#FEATURE_TELEPHONY feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true if the device is a world phone, and false otherwise.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY.

      listen

      Added in API level 1
      Deprecated in API level 31
      open fun listen(
          listener: PhoneStateListener!,
          events: Int
      ): Unit

      Deprecated: Use registerTelephonyCallback(java.util.concurrent.Executor,android.telephony.TelephonyCallback).

      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 LISTEN_NONE (0). If this TelephonyManager object has been created with createForSubscriptionId, 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. Note: if you call this method while in the middle of a binder transaction, you must call android.os.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.

      purchasePremiumCapability

      Added in API level 34
      open fun purchasePremiumCapability(
          capability: Int,
          executor: Executor,
          callback: Consumer<Int!>
      ): Unit

      Purchase the given premium capability from the carrier. This requires user action to purchase the boost from the carrier. If this returns PURCHASE_PREMIUM_CAPABILITY_RESULT_SUCCESS or PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED, applications can request the premium capability via android.net.ConnectivityManager#requestNetwork.
      Requires android.Manifest.permission#READ_BASIC_PHONE_STATE and android.Manifest.permission#INTERNET
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      capability Int: The premium capability to purchase. Value is android.telephony.TelephonyManager#PREMIUM_CAPABILITY_PRIORITIZE_LATENCY
      executor Executor: The callback executor for the response. 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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
      callback Consumer<Int!>: The result of the purchase request. This value cannot be null. Value is android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_SUCCESS, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_ERROR, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_TIMEOUT, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_FEATURE_NOT_SUPPORTED, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_NOT_AVAILABLE, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_ENTITLEMENT_CHECK_FAILED, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUBSCRIPTION, android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP, or android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_DISABLED
      Exceptions
      java.lang.SecurityException if the caller does not hold permissions READ_BASIC_PHONE_STATE or INTERNET.
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      rebootModem

      Added in API level 33
      open fun rebootModem(): Unit

      Generate a radio modem reset. Used for device configuration by some carriers.

      Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Exceptions
      java.lang.IllegalStateException if the Telephony process is not currently available.
      java.lang.RuntimeException
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      registerTelephonyCallback

      Added in API level 31
      open fun registerTelephonyCallback(
          executor: Executor,
          callback: TelephonyCallback
      ): Unit

      Registers a callback object to receive notification of changes in specified telephony states.

      To register a callback, pass a TelephonyCallback which implements interfaces of events. For example, FakeServiceStateCallback extends TelephonyCallback implements TelephonyCallback.ServiceStateListener. At registration, and when a specified telephony state changes, the telephony manager invokes the appropriate callback method on the callback object and passes the current (updated) values.

      Note: Be aware of the permission requirements stated on the TelephonyCallback listeners you implement. Your application must be granted these permissions in order to register a TelephonyCallback which requires them; a SecurityException will be thrown if you do not hold the required permissions for all TelephonyCallback listeners you implement.

      If this TelephonyManager object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId(). To register events for multiple subIds, pass a separate callback object to each TelephonyManager object created with createForSubscriptionId. Note: if you call this method while in the middle of a binder transaction, you must call android.os.Binder#clearCallingIdentity() before calling this method. A SecurityException will be thrown otherwise. This API should be used sparingly -- large numbers of callbacks will cause system instability. If a process has registered too many callbacks without unregistering them, it may encounter an IllegalStateException when trying to register more callbacks.

      Parameters
      executor Executor: The executor of where the callback will execute. 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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
      callback TelephonyCallback: The TelephonyCallback object to register. The caller should hold a reference to the callback. The framework only holds a weak reference. This value cannot be null.

      registerTelephonyCallback

      Added in API level 33
      open fun registerTelephonyCallback(
          includeLocationData: Int,
          executor: Executor,
          callback: TelephonyCallback
      ): Unit

      Registers a callback object to receive notification of changes in specified telephony states.

      To register a callback, pass a TelephonyCallback which implements interfaces of events. For example, FakeServiceStateCallback extends TelephonyCallback implements TelephonyCallback.ServiceStateListener. At registration, and when a specified telephony state changes, the telephony manager invokes the appropriate callback method on the callback object and passes the current (updated) values.

      If this TelephonyManager object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId(). To register events for multiple subIds, pass a separate callback object to each TelephonyManager object created with createForSubscriptionId. Note: if you call this method while in the middle of a binder transaction, you must call android.os.Binder#clearCallingIdentity() before calling this method. A SecurityException will be thrown otherwise. This API should be used sparingly -- large numbers of callbacks will cause system instability. If a process has registered too many callbacks without unregistering them, it may encounter an IllegalStateException when trying to register more callbacks.

      There's another way to renounce permissions with a custom context AttributionSource.Builder#setRenouncedPermissions(Set<String>) but only for system apps. To avoid confusion, calling this method supersede renouncing permissions with a custom context.

      Parameters
      includeLocationData Int: Specifies if the caller would like to receive location related information. Value is android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_NONE, android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_COARSE, or android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_FINE
      executor Executor: The executor of where the callback will execute. 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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
      callback TelephonyCallback: The TelephonyCallback object to register. The caller should hold a reference to the callback. The framework only holds a weak reference. This value cannot be null.

      requestCellInfoUpdate

      Added in API level 29
      open fun requestCellInfoUpdate(
          executor: Executor,
          callback: TelephonyManager.CellInfoCallback
      ): Unit

      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 android.Manifest.permission#ACCESS_FINE_LOCATION
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
      callback TelephonyManager.CellInfoCallback: a callback to receive CellInfo. This value cannot be null.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      requestNetworkScan

      Added in API level 28
      open fun requestNetworkScan(
          request: NetworkScanRequest!,
          executor: Executor!,
          callback: TelephonyScanManager.NetworkScanCallback!
      ): NetworkScan!

      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 android.Manifest.permission#ACCESS_FINE_LOCATION. If the system-wide location switch is off, apps may still call this API, with the following constraints:

      1. The app must hold the android.permission.NETWORK_SCAN permission.
      2. The app must not supply any specific bands or channels to scan.
      3. The app must only specify MCC/MNC pairs that are associated to a SIM in the device.
      4. Returned results will have no meaningful info other than signal strength and MCC/MNC info.

      Requires android.Manifest.permission#MODIFY_PHONE_STATE and android.Manifest.permission#ACCESS_FINE_LOCATION
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).
      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.
      callback TelephonyScanManager.NetworkScanCallback!: Returns network scan results or errors.
      Return
      NetworkScan! A NetworkScan obj which contains a callback which can be used to stop the scan.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      requestNetworkScan

      Added in API level 33
      open fun requestNetworkScan(
          includeLocationData: Int,
          request: NetworkScanRequest,
          executor: Executor,
          callback: TelephonyScanManager.NetworkScanCallback
      ): NetworkScan?

      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 android.Manifest.permission#ACCESS_FINE_LOCATION if includeLocationData is set to INCLUDE_LOCATION_DATA_FINE. If the system-wide location switch is off, apps may still call this API, with the following constraints:

      1. The app must hold the android.permission.NETWORK_SCAN permission.
      2. The app must not supply any specific bands or channels to scan.
      3. The app must only specify MCC/MNC pairs that are associated to a SIM in the device.
      4. Returned results will have no meaningful info other than signal strength and MCC/MNC info.

      Requires android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).
      Parameters
      includeLocationData Int: Specifies if the caller would like to receive location related information. If this parameter is set to INCLUDE_LOCATION_DATA_FINE then the application will be checked for android.Manifest.permission#ACCESS_FINE_LOCATION permission and available location related information received during network scan will be sent to the caller. Value is android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_NONE, android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_COARSE, or android.telephony.TelephonyManager#INCLUDE_LOCATION_DATA_FINE
      request NetworkScanRequest: Contains all the RAT with bands/channels that need to be scanned. This value cannot be null.
      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. This value cannot be null.
      callback TelephonyScanManager.NetworkScanCallback: Returns network scan results or errors. This value cannot be null.
      Return
      NetworkScan? A NetworkScan obj which contains a callback which can be used to stop the scan. This value may be null.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      sendDialerSpecialCode

      Added in API level 26
      open fun sendDialerSpecialCode(inputCode: String!): Unit

      Send the special dialer code. The IPC caller must be the current default dialer or have carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      inputCode String!: The special dialer code to send
      Exceptions
      java.lang.SecurityException if the caller does not have carrier privileges or is not the current default dialer
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      sendEnvelopeWithStatus

      Added in API level 21
      open fun sendEnvelopeWithStatus(content: String!): String!

      Send ENVELOPE to the SIM and return the response.

      Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      content String!: String containing SAT/USAT response in hexadecimal format starting with command tag. See TS 102 223 for details.
      Return
      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.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      sendUssdRequest

      Added in API level 26
      open fun sendUssdRequest(
          ussdRequest: String!,
          callback: TelephonyManager.UssdResponseCallback!,
          handler: Handler!
      ): Unit

      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: android.Manifest.permission#CALL_PHONE
      Requires android.Manifest.permission#CALL_PHONE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      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.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      sendVisualVoicemailSms

      Added in API level 26
      open fun sendVisualVoicemailSms(
          number: String!,
          port: Int,
          text: String!,
          sentIntent: PendingIntent!
      ): Unit

      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
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      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
      Exceptions
      java.lang.SecurityException if the caller is not the current default dialer
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      setAllowedNetworkTypesForReason

      Added in API level 33
      open fun setAllowedNetworkTypesForReason(
          reason: Int,
          allowedNetworkTypes: Long
      ): Unit

      Set the allowed network types of the device and provide the reason triggering the allowed network change.

      Requires permission: android.Manifest.permission#MODIFY_PHONE_STATE or that the calling app has carrier privileges (see hasCarrierPrivileges). This can be called for following reasons:

      1. Allowed network types control by USER TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER
      2. Allowed network types control by carrier ALLOWED_NETWORK_TYPES_REASON_CARRIER
      This API will result in allowing an intersection of allowed network types for all reasons, including the configuration done through other reasons.
      Requires android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the TelephonyManager#CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK feature which can be detected using TelephonyManager.isRadioInterfaceCapabilitySupported(String).
      Parameters
      reason Int: the reason the allowed network type change is taking place Value is android.telephony.TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER, android.telephony.TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_POWER, android.telephony.TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER, or android.telephony.TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G
      allowedNetworkTypes Long: The bitmask of allowed network type Value is either 0 or a combination of android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_LTE_CA, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_NR, android.telephony.TelephonyManager#NETWORK_TYPE_BITMASK_IWLAN, and android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_IDEN
      Exceptions
      java.lang.IllegalStateException if the Telephony process is not currently available.
      java.lang.IllegalArgumentException if invalid AllowedNetworkTypesReason is passed.
      java.lang.SecurityException if the caller does not have the required privileges or if the
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      setCallComposerStatus

      Added in API level 31
      open fun setCallComposerStatus(status: Int): Unit

      Set the user-set status for enriched calling with call composer.
      Requires android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      status Int: user-set status for enriched calling with call composer.

      If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId() Value is android.telephony.TelephonyManager#CALL_COMPOSER_STATUS_ON, android.telephony.TelephonyManager#CALL_COMPOSER_STATUS_OFF, or android.telephony.TelephonyManager#CALL_COMPOSER_STATUS_BUSINESS_ONLY

      Exceptions
      java.lang.IllegalArgumentException if requested state is invalid.
      java.lang.SecurityException if the caller does not have the permission.
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      setDataEnabled

      Added in API level 26
      Deprecated in API level 31
      open fun setDataEnabled(enable: Boolean): Unit

      Deprecated: use setDataEnabledForReason with reason DATA_ENABLED_REASON_USER instead.

      Turns mobile data on or off. If this object has been created with createForSubscriptionId, 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 android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      enable Boolean: Whether to enable mobile data.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      setDataEnabledForReason

      Added in API level 31
      open fun setDataEnabledForReason(
          reason: Int,
          enabled: Boolean
      ): Unit

      Control of data connection and provide the reason triggering the data connection control. This can be called for following reasons

      1. data limit is passed DATA_ENABLED_REASON_POLICY
      2. data disabled by carrier DATA_ENABLED_REASON_CARRIER
      3. data disabled by user DATA_ENABLED_REASON_USER
      4. data disabled due to thermal DATA_ENABLED_REASON_THERMAL
      If any of the reason is off, then it will result in bypassing user preference and result in data to be turned off.

      If this object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()
      Requires android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      reason Int: the reason the data enable change is taking place Value is android.telephony.TelephonyManager#DATA_ENABLED_REASON_USER, android.telephony.TelephonyManager#DATA_ENABLED_REASON_POLICY, android.telephony.TelephonyManager#DATA_ENABLED_REASON_CARRIER, or android.telephony.TelephonyManager#DATA_ENABLED_REASON_THERMAL
      enabled Boolean: True if enabling the data, otherwise disabling.

      Requires Permission: The calling app has carrier privileges (see hasCarrierPrivileges) if the reason is DATA_ENABLED_REASON_USER or DATA_ENABLED_REASON_CARRIER or the call app has MODIFY_PHONE_STATE irrespective of the reason.

      Exceptions
      java.lang.IllegalStateException if the Telephony process is not currently available.
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      setForbiddenPlmns

      Added in API level 30
      open fun setForbiddenPlmns(fplmns: MutableList<String!>): Int

      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 android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      fplmns MutableList<String!>: a list of PLMNs to be forbidden. This value cannot be null.
      Return
      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
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      setLine1NumberForDisplay

      Added in API level 22
      Deprecated in API level 33
      open fun setLine1NumberForDisplay(
          alphaTag: String!,
          number: String!
      ): Boolean

      Deprecated: use SubscriptionManager#setCarrierPhoneNumber(int, String) instead.

      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).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      alphaTag String!: alpha-tagging of the dailing nubmer
      number String!: The dialing number
      Return
      Boolean true if the operation was executed correctly.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      setNetworkSelectionModeAutomatic

      Added in API level 28
      open fun setNetworkSelectionModeAutomatic(): Unit

      Sets the network selection mode to automatic.

      If this object has been created with createForSubscriptionId, 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 android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      setNetworkSelectionModeManual

      Added in API level 28
      open fun setNetworkSelectionModeManual(
          operatorNumeric: String!,
          persistSelection: Boolean
      ): Boolean

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

      If this object has been created with createForSubscriptionId, 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 android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      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.
      Return
      Boolean true on success; false on any failure.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      setNetworkSelectionModeManual

      Added in API level 30
      open fun setNetworkSelectionModeManual(
          operatorNumeric: String,
          persistSelection: Boolean,
          ran: Int
      ): Boolean

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

      If this object has been created with createForSubscriptionId, 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 android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      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 android.telephony.AccessNetworkConstants.AccessNetworkType#UNKNOWN, android.telephony.AccessNetworkConstants.AccessNetworkType#GERAN, android.telephony.AccessNetworkConstants.AccessNetworkType#UTRAN, android.telephony.AccessNetworkConstants.AccessNetworkType#EUTRAN, android.telephony.AccessNetworkConstants.AccessNetworkType#CDMA2000, android.telephony.AccessNetworkConstants.AccessNetworkType#IWLAN, or android.telephony.AccessNetworkConstants.AccessNetworkType#NGRAN
      Return
      Boolean true on success; false on any failure.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      setOperatorBrandOverride

      Added in API level 22
      open fun setOperatorBrandOverride(brand: String!): Boolean

      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).
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      brand String!: The brand name to display/set.
      Return
      Boolean true if the operation was executed correctly.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      setPreferredNetworkTypeToGlobal

      Added in API level 22
      open fun setPreferredNetworkTypeToGlobal(): Boolean

      Set the preferred network type to global mode which includes NR, LTE, CDMA, EvDo and GSM/WCDMA.

      Requires that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Return
      Boolean true on success; false on any failure.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      setPreferredOpportunisticDataSubscription

      Added in API level 29
      open fun setPreferredOpportunisticDataSubscription(
          subId: Int,
          needValidation: Boolean,
          executor: Executor?,
          callback: Consumer<Int!>?
      ): Unit

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_DATA feature which can be detected using PackageManager.hasSystemFeature(String).

      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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
      callback Consumer<Int!>?: Callback will be triggered once it succeeds or failed. See the SET_OPPORTUNISTIC_SUB_* constants for more details. Pass null if don't care about the result.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_DATA.

      setSignalStrengthUpdateRequest

      Added in API level 31
      open fun setSignalStrengthUpdateRequest(request: SignalStrengthUpdateRequest): Unit

      Set a SignalStrengthUpdateRequest to receive notification when signal quality measurements breach the specified thresholds. To be notified, set the signal strength update request and then register TelephonyCallback that implements TelephonyCallback.SignalStrengthsListener through #registerTelephonyCallback. The notification will arrive through TelephonyCallback.SignalStrengthsListener#onSignalStrengthsChanged(SignalStrength). To stop receiving the notification over the specified thresholds, pass the same SignalStrengthUpdateRequest object to clearSignalStrengthUpdateRequest(android.telephony.SignalStrengthUpdateRequest). System will clean up the SignalStrengthUpdateRequest if the caller process died without calling clearSignalStrengthUpdateRequest(android.telephony.SignalStrengthUpdateRequest). If this TelephonyManager object has been created with createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId(). To request for multiple subIds, pass a request object to each TelephonyManager object created with createForSubscriptionId.

      Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges). Note that the thresholds in the request will be used on a best-effort basis; the system may modify requests to multiplex various request sources or to optimize power consumption. The caller should not expect to be notified with the exactly the same thresholds.
      Requires android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      request SignalStrengthUpdateRequest: the SignalStrengthUpdateRequest to be set into the System This value cannot be null.
      Exceptions
      java.lang.IllegalStateException if a new request is set with same subId from the same caller
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      setVisualVoicemailSmsFilterSettings

      Added in API level 26
      open fun setVisualVoicemailSmsFilterSettings(settings: VisualVoicemailSmsFilterSettings!): Unit

      Set the visual voicemail SMS filter settings for the subscription ID pinned to the TelephonyManager. When the filter is enabled, android.telephony.VisualVoicemailService#onSmsReceived(android.telephony.VisualVoicemailService.VisualVoicemailTask,android.telephony.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.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      settings VisualVoicemailSmsFilterSettings!: The settings for the filter, or null to disable the filter.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      setVoiceMailNumber

      Added in API level 22
      open fun setVoiceMailNumber(
          alphaTag: String!,
          number: String!
      ): Boolean

      Sets the voice mail number.

      Requires that the calling app has carrier privileges (see hasCarrierPrivileges).
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      alphaTag String!: The alpha tag to display.
      number String!: The voicemail number.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      setVoicemailRingtoneUri

      Added in API level 26
      Deprecated in API level 28
      open fun setVoicemailRingtoneUri(
          phoneAccountHandle: PhoneAccountHandle!,
          uri: Uri!
      ): Unit

      Deprecated: Use android.provider.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.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      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.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      setVoicemailVibrationEnabled

      Added in API level 26
      Deprecated in API level 28
      open fun setVoicemailVibrationEnabled(
          phoneAccountHandle: PhoneAccountHandle!,
          enabled: Boolean
      ): Unit

      Deprecated: Use android.provider.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.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      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.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      switchMultiSimConfig

      Added in API level 29
      open fun switchMultiSimConfig(numOfSims: Int): Unit

      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 android.Manifest.permission#MODIFY_PHONE_STATE
      Requires the PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      numOfSims Int: number of live SIMs we want to switch to
      Exceptions
      android.os.RemoteException
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION.

      unregisterTelephonyCallback

      Added in API level 31
      open fun unregisterTelephonyCallback(callback: TelephonyCallback): Unit

      Unregister an existing TelephonyCallback.

      Parameters
      callback TelephonyCallback: The TelephonyCallback object to unregister. This value cannot be null.

      updateAvailableNetworks

      Added in API level 29
      open fun updateAvailableNetworks(
          availableNetworks: MutableList<AvailableNetworkInfo!>,
          executor: Executor?,
          callback: Consumer<Int!>?
      ): Unit

      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.
      Requires the PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      availableNetworks MutableList<AvailableNetworkInfo!>: 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(). Otherwise, provide an Executor that dispatches to an appropriate thread.
      callback Consumer<Int!>?: Callback will be triggered once it succeeds or failed. Value is android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_SUCCESS, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_ABORTED, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION, android.telephony.TelephonyManager#UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED, or android.telephony.TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SIM_PORT_NOT_AVAILABLE This value may be null.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS.

      uploadCallComposerPicture

      Added in API level 31
      open fun uploadCallComposerPicture(
          pictureToUpload: Path,
          contentType: String,
          executor: Executor,
          callback: OutcomeReceiver<ParcelUuid!, TelephonyManager.CallComposerException!>
      ): Unit

      Uploads a picture to the carrier network for use with call composer.
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      pictureToUpload Path: Path to a local file containing the picture to upload. This value cannot be null.
      contentType String: The MIME type of the picture you're uploading (e.g. image/jpeg) This value cannot be null.
      executor Executor: The Executor on which the pictureToUpload file will be read from disk, as well as on which callback will be called. 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(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.
      callback OutcomeReceiver<ParcelUuid!, TelephonyManager.CallComposerException!>: A callback called when the upload operation terminates, either in success or in error. This value cannot be null.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      uploadCallComposerPicture

      Added in API level 31
      open fun uploadCallComposerPicture(
          pictureToUpload: InputStream,
          contentType: String,
          executor: Executor,
          callback: OutcomeReceiver<ParcelUuid!, TelephonyManager.CallComposerException!>
      ): Unit

      Uploads a picture to the carrier network for use with call composer. This method allows a dialer app to upload a picture to the carrier network that can then later be attached to an outgoing call. In order to attach the picture to a call, use the ParcelUuid returned from callback upon successful upload as the value to TelecomManager#EXTRA_OUTGOING_PICTURE. This functionality is only available to the app filling the RoleManager#ROLE_DIALER role on the device. This functionality is only available when CarrierConfigManager#KEY_SUPPORTS_CALL_COMPOSER_BOOL is set to true in the bundle returned from getCarrierConfig().
      Requires the PackageManager#FEATURE_TELEPHONY_CALLING feature which can be detected using PackageManager.hasSystemFeature(String).

      Parameters
      pictureToUpload InputStream: An InputStream that supplies the bytes representing the picture to upload. The client bears responsibility for closing this stream after callback is called with success or failure. Additionally, if the stream supplies more bytes than the return value of getMaximumCallComposerPictureSize(), the upload will be aborted and the callback will be called with an exception containing CallComposerException#ERROR_FILE_TOO_LARGE. This value cannot be null.
      contentType String: The MIME type of the picture you're uploading (e.g. image/jpeg). The list of acceptable content types can be found at 3GPP TS 26.141 sections 4.2 and 4.3. This value cannot be null.
      executor Executor: The Executor on which the pictureToUpload stream will be read, as well as on which the callback will be called. 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(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.
      callback OutcomeReceiver<ParcelUuid!, TelephonyManager.CallComposerException!>: A callback called when the upload operation terminates, either in success or in error. This value cannot be null.
      Exceptions
      java.lang.UnsupportedOperationException If the device does not have PackageManager#FEATURE_TELEPHONY_CALLING.

      Properties

      EXTRA_STATE_IDLE

      Added in API level 3
      static val EXTRA_STATE_IDLE: String!

      Value used with EXTRA_STATE corresponding to CALL_STATE_IDLE.

      EXTRA_STATE_OFFHOOK

      Added in API level 3
      static val EXTRA_STATE_OFFHOOK: String!

      Value used with EXTRA_STATE corresponding to CALL_STATE_OFFHOOK.

      EXTRA_STATE_RINGING

      Added in API level 3
      static val EXTRA_STATE_RINGING: String!

      Value used with EXTRA_STATE corresponding to CALL_STATE_RINGING.