The telephony core service initializes the SimManager, NetworkSearchManager, and TelRilManager modules, and provides access to the RIL Adapter service.
You can implement communication with the RIL Adapter by registering the callback service and implement communication between modules by subscribing to callbacks.
- SimManager: provides services including SIM card initialization, file read/write, loading status notification, and single-SIM/dual-SIM control. These services implement functions such as SIM card status query, SIM card management, SIM card control, STK, contact storage, and SMS storage.
- NetworkSearchManager: provides services including network registration and network status acquisition. These services offer functions such as network registration, network mode query, IMS network status reporting, radio service status query, radio service management, signal strength query, cell management, registration status management, and time and time zone setting.
- Software constraints: This module must work with the HDF (drivers\_interface and drivers\_peripheral), RIL Adapter service \(ril\_adapter\), and state registry service \(state\_registry\).
| function getSimState(slotId: number, callback: AsyncCallback\<SimState>): void; | Obtains the state of the SIM card in a specified slot. | – |
| function getSimGid1(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the group identifier level 1 \(GID1\) of the SIM card in the specified slot. | ohos.permission.GET_TELEPHONY_STATE |
| function getSimIccId(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the integrated circuit card identity \(ICCID\) of the SIM card in the specified slot.| ohos.permission.GET_TELEPHONY_STATE |
| function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the ISO country code of the SIM card in the specified slot. | – |
| function getSimOperatorNumeric(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specified slot. | – |
| function getSimSpn(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the service provider name \(SPN\) of the SIM card in the specified slot. | – |
| function getDefaultVoiceSlotId(callback: AsyncCallback\<number>): void; | Obtains the slot of the default SIM card that provides the voice service. | – |
| function getDefaultVoiceSimId(callback: AsyncCallback\<number>): void; | Obtains the sim id of the default SIM card that provides the voice service. | – |
| function isSimActive(slotId: number, callback: AsyncCallback\<boolean>): void | Checks whether the SIM card in the specified slot is activated. | – |
| function hasSimCard(slotId: number, callback: AsyncCallback\<boolean>): void | Checks whether the specified slot is populated with a SIM card. | – |
| function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void | Obtains the mobile station integrated services digital network (MSISDN) of the SIM card in the specified slot.|ohos.permission.GET_PHONE_NUMBERS |
| function getVoiceMailIdentifier(slotId: number, callback: AsyncCallback\<string>): void | Obtains the voice mailbox identifier of the SIM card in the specified slot.| ohos.permission.GET_TELEPHONY_STATE |
| function getVoiceMailNumber(slotId: number, callback: AsyncCallback\<string>): void | Obtains the voice mailbox number of the SIM card in the specified slot.| ohos.permission.GET_TELEPHONY_STATE |
| function getCardType(slotId: number, callback: AsyncCallback\<CardType>): void | Obtains the type of the SIM card in the specified slot. | –|
| function hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean>): void | Checks whether the application (caller) has been granted the operator permission.| –|
| function getMaxSimCount(): number | Obtains the maximum number of SIM cards, that is, the maximum number of SIM card slots, available on the device.| –|
For details about the complete description of JavaScript APIs and sample code, see [SIM Card Management](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-sim.md).
| function getRadioTech(slotId: number, callback: AsyncCallback\<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void; | Obtains the current radio access technology of the SIM card in the specified slot. | ohos.permission.GET_NETWORK_INFO |
| function getSignalInformation(slotId: number, callback: AsyncCallback\<Array\<SignalInformation>>): void; | Obtains the signal information of the SIM card in the specified slot. | – |
| function getNetworkState(slotId: number, callback: AsyncCallback\<NetworkState>): void; | Obtains the network status of the SIM card in the specified slot. | ohos.permission.GET_NETWORK_INFO |
| function getISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the ISO country code of the SIM card in the specified slot. | – |
| function getNetworkSearchInformation(slotId: number, callback: AsyncCallback\<NetworkSearchResult>): void; | Obtains the manual network search result of the SIM card in the specified slot. | ohos.permission.GET_TELEPHONY_STATE |
| function getNetworkSelectionMode(slotId: number, callback: AsyncCallback\<NetworkSelectionMode>): void; | Obtains the network selection mode of the SIM card in the specified slot. | – |
| function setNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback\<void>): void; | Sets the network selection mode of the SIM card in the specified slot. | ohos.permission.SET_TELEPHONY_STATE |
| function isRadioOn(callback: AsyncCallback\<boolean>): void; | Checks whether the radio service is enabled on the primary SIM card. | ohos.permission.GET_NETWORK_INFO |
| function isRadioOn(slotId: number, callback: AsyncCallback\<boolean>): void; | Checks whether the radio service is enabled on the SIM card in the specified slot.| ohos.permission.GET_NETWORK_INFO |
| function turnOnRadio(callback: AsyncCallback\<void>): void; | Enables the radio service on the primary SIM card. | ohos.permission.SET_TELEPHONY_STATE |
| function turnOnRadio(slotId: number, callback: AsyncCallback\<void>): void; | Enables the radio service on the SIM card in the specified slot. | ohos.permission.SET_TELEPHONY_STATE |
| function turnOffRadio(callback: AsyncCallback\<void>): void; | Disables the radio service on the primary SIM card. | ohos.permission.SET_TELEPHONY_STATE |
| function turnOffRadio(slotId: number, callback: AsyncCallback\<void>): void; | Disables the radio service on the SIM card in the specified slot. | ohos.permission.SET_TELEPHONY_STATE |
| function getOperatorName(slotId: number, callback: AsyncCallback\<string>): void; | Obtains the carrier name of the SIM card in the specified slot. | – |
| function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\<void>): void; | Sets the preferred network of the SIM card in the specified slot. | ohos.permission.SET_TELEPHONY_STATE |
| function getPreferredNetwork(slotId: number, callback: AsyncCallback\<PreferredNetworkMode>): void; | Obtains the preferred network of the SIM card in the specified slot. | ohos.permission.GET_TELEPHONY_STATE |
| function getCellInformation(slotId: number, callback: AsyncCallback<Array\<CellInformation>>) | Obtains the cell information list. | ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
| function sendUpdateCellLocationRequest(slotId: number, callback: AsyncCallback\<void>) | Requests for a cell location update. | ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
| function getIMEI(slotId: number, callback: AsyncCallback\<string>) | Obtains the international mobile equipment identity (IMEI). | ohos.permission.GET_TELEPHONY_STATE |
| function getMEID(slotId: number, callback: AsyncCallback\<string>)| Obtains the mobile equipment identifier (MEID). | ohos.permission.GET_TELEPHONY_STATE |
| function getUniqueDeviceId(slotId: number, callback: AsyncCallback\<string>)| Obtains the unique ID of a device. | ohos.permission.GET_TELEPHONY_STATE |
For details about the complete description of JavaScript APIs and sample code, see [Radio](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-radio.md).
1. Query the SIM card in the slot specified by **slotId**. If **slotId** is not set, information about the primary card is queried by default.
2. Call the **getNetworkState** method in callback or promise mode to obtain the network status.
3. Obtain the SIM card status information. The **getNetworkState** method works in asynchronous mode. The execution result is returned through the callback.
2. Call the **getSimState** method in callback or promise mode to obtain the SIM card status.
3. Obtain the SIM card status information. The **getSimState** method works in asynchronous mode. The execution result is returned through the callback.