public class SimInfoManager extends Object
This class is a singleton class. Applications can use the getInstance method to obtain an instance
and then use the instance to invoke the method for obtaining SIM card information.
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getCardType(int slotId) |
Obtains the type of the SIM card installed in a specified slot.
|
int |
getDefaultVoiceSlotId() |
Obtains the default card slot for the voice service.
|
static SimInfoManager |
getInstance(Context context) |
Obtains an instance of SimInfoManager.
|
String |
getIsoCountryCodeForSim(int slotId) |
Obtains the ISO country code of the SIM card in a specified slot.
|
String |
getLine1NumberFromImpu(int slotId) |
Obtains the Line 1 phone number from the registered IP multimedia subsystem (IMS) based on a specified slot ID.
|
int |
getMaxSimCount() |
Obtains the maximum number of SIM cards that can be used simultaneously on the device,
that is, the maximum number of SIM card slots.
|
String |
getSimGid1(int slotId) |
Obtains the Group Identifier Level 1 (GID1) of the SIM card in a specified slot.
|
String |
getSimIccId(int slotId) |
Obtains the ICCID of the SIM card in a specified slot.
|
String |
getSimOperatorNumeric(int slotId) |
Obtains the home PLMN number of the SIM card in a specified slot.
|
String |
getSimSpn(int slotId) |
Obtains the service provider name (SPN) of the SIM card in a specified slot.
|
int |
getSimState(int slotId) |
Obtains the state of the SIM card in a specified slot.
|
String |
getSimTeleNumberIdentifier(int slotId) |
Obtains the alpha identifier of the phone number of the SIM card in a specified slot.
|
String |
getSimTelephoneNumber(int slotId) |
Obtains the MSISDN of the SIM card in a specified slot.
|
int |
getVoiceMailCount(int slotId) |
Obtains the number of messages in the voice mailbox of the SIM card in the specified slot.
|
String |
getVoiceMailIdentifier(int slotId) |
Obtains the alpha identifier of the voice mailbox of the SIM card in a specified slot.
|
String |
getVoiceMailNumber(int slotId) |
Obtains the voice mailbox number of the SIM card in a specified slot.
|
boolean |
hasOperatorPrivileges(int slotId) |
Checks whether your application (the caller) has been granted the operator permissions.
|
boolean |
hasSimCard(int slotId) |
Checks whether a SIM card is inserted in a specified slot.
|
boolean |
isSimActive(int slotId) |
Checks whether the SIM card in a specified slot is activated.
|
boolean |
isSupportMultiSim() |
Checks whether the device supports multiple SIM cards, that is, whether there are multiple card slots.
|
public static SimInfoManager getInstance(Context context)
context - Indicates the context of the application.public boolean isSupportMultiSim()
public int getMaxSimCount()
public String getIsoCountryCodeForSim(int slotId)
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getSimOperatorNumeric(int slotId)
The value is recorded in the SIM card and is irrelevant to the network with which the SIM card is currently registered.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getSimSpn(int slotId)
The value is recorded in the EFSPN file of the SIM card and is irrelevant to the network with which the SIM card is currently registered.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getSimIccId(int slotId)
The ICCID is a unique identifier of a SIM card. It consists of 20 digits and is recorded in the EFICCID file of the SIM card.
Requires Permission: ohos.permission.GET_TELEPHONY_STATE.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getSimTelephoneNumber(int slotId)
Requires Permission: ohos.permission.GET_TELEPHONY_STATE.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getSimGid1(int slotId)
Requires Permission: ohos.permission.GET_TELEPHONY_STATE.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public int getSimState(int slotId)
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public boolean hasSimCard(int slotId)
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getSimTeleNumberIdentifier(int slotId)
Only applications with the ohos.permission.GET_TELEPHONY_STATE permission can call this method.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getVoiceMailNumber(int slotId)
Only applications with the ohos.permission.GET_TELEPHONY_STATE permission can call this method.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public int getVoiceMailCount(int slotId)
Only applications with the ohos.permission.GET_TELEPHONY_STATE permission can call this method.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public String getVoiceMailIdentifier(int slotId)
Only applications with the ohos.permission.GET_TELEPHONY_STATE permission can call this method.
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.public boolean isSimActive(int slotId)
slotId - Indicates the card slot index number,
ranging from 0 to the maximum card slot index number supported by the device.true if the SIM card is activated; returns false otherwise.public int getDefaultVoiceSlotId()
0 if card 1 is used as the default card slot for the voice service;
returns 1 if card 2 is used as the default card slot for the voice service;
returns -1 if no card is available for the voice service.public boolean hasOperatorPrivileges(int slotId)
slotId - Indicates the ID of the SIM card slot.true if your application has been granted the operator permissions;
returns false otherwise.public String getLine1NumberFromImpu(int slotId)
Permissions: SystemPermission.GET_TELEPHONY_STATE
slotId - Indicates the ID of the specified slot.public int getCardType(int slotId)
slotId - Indicates the ID of the specified slot.