This is a API to get data from the SIM card like the carrier name, mcc, mnc and country code and other system dependent additional info.
SIM.getSimInfo()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
window.SIM.getSimInfo()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
window.SIM.getSimInfo()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
(<any>window).SIM.getSimInfo()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
window.SIM.getSimInfo()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
getSimInfo(): Promise<GetInfoResults>
Get data from the SIM card.
This method needs PHONE Permission to get some information. To get all the information, use the requestReadPermission method.
hasReadPermission(): Promise<boolean>
Check if user has PHONE Permission.
requestReadPermission(): Promise<any>
Prompt the user to give PHONE Permission.
interface GetInfoResults { // Service Provider Name carrierName : string; // ISO country code equivalent for the SIM provider's country code countryCode : string; MCC (mobile country code) of the provider of the SIM mcc: string; MNC (mobile network code) of the provider of the SIM mnc: string; // call state (cellular) on the device callState: CallState; // type of activity on a data connection (cellular) dataActivity: DataActivity; // the NETWORK_TYPE_xxxx for current data connection networkType: NetworkType; // device phone type. This indicates the type of radio used to transmit voice calls phoneType: PhoneType; // the state of the device SIM card simState: SIMState; // true if the device is considered roaming on the current network, for GSM purposes isNetworkRoaming: boolean; // 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) phoneCount: int; // [PHONE Permission] the current number of active subscriptions activeSubscriptionInfoCount: int; // [PHONE Permission] the maximum number of active subscriptions activeSubscriptionInfoCountMax: int; // [PHONE Permission] - phone number string for line 1, for example, the MSISDN for a GSM phone 1 phoneNumber: string; // [PHONE Permission] the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones deviceId: string; // [PHONE Permission] the software version number for the device, for example, the IMEI/SV for GSM phones deviceSoftwareVersion: string; // [PHONE Permission] the serial number of the SIM, if applicable simSerialNumber: string; // [PHONE Permission] the unique subscriber ID, for example, the IMSI for a GSM phone subscriberId: string; // [PHONE Permission] List of SIM cards cards: Cards array; }
This API needs PHONE Permission for getting the following values:
interface Cards { // The name displayed to the user that identifies Subscription provider name carrierName: string; // The name displayed to the user that identifies this subscription displayName: string; // The ISO country code countryCode: string; // MCC (mobile country code) of the provider of the SIM mcc: string; // MNC (mobile network code) of the provider of the SIM mnc: string; // Returns true if the device is considered roaming on the current network for a subscription isNetworkRoaming: boolean; // The data roaming state for this subscription isDataRoaming: boolean; // The slot index of this Subscription's SIM card simSlotIndex: int; // The number of this subscription phoneNumber: string; // The unique device ID of a subscription, for example, the IMEI for GSM and the MEID for CDMA phones deviceId: string; // ICC ID simSerialNumber: string; // Subscription Identifier, this is a device unique number subscriptionId: string }
CallState = { CALL_STATE_IDLE: 0 // No activity CALL_STATE_RINGING: 1 // Ringing. A new call arrived and is ringing or waiting. In the latter case, another call is already active. CALL_STATE_OFFHOOK: 2 // Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting. }
DataActivity = { DATA_ACTIVITY_NONE: 0 // No traffic DATA_ACTIVITY_IN: 1 // Currently receiving IP PPP traffic DATA_ACTIVITY_OUT: 2 // Currently sending IP PPP traffic DATA_ACTIVITY_INOUT: 3 // Currently both sending and receiving IP PPP traffic DATA_ACTIVITY_DORMANT: 4 // Data connection is active, but physical link is down }
NetworkType = { NETWORK_TYPE_UNKNOWN: 0 // unknown NETWORK_TYPE_GPRS: 1 // GPRS NETWORK_TYPE_EDGE: 2 // EDGE NETWORK_TYPE_UMTS: 3 // UMTS NETWORK_TYPE_CDMA: 4 // CDMA: Either IS95A or IS95B NETWORK_TYPE_EVDO_0: 5 // EVDO revision 0 NETWORK_TYPE_EVDO_A: 6 // EVDO revision A NETWORK_TYPE_1xRTT: 7 // 1xRTT NETWORK_TYPE_HSDPA: 8 // HSDPA NETWORK_TYPE_HSUPA: 9 // HSUPA NETWORK_TYPE_HSPA: 10 // HSPA NETWORK_TYPE_IDEN: 11 // iDen NETWORK_TYPE_EVDO_B: 12 // EVDO revision B NETWORK_TYPE_LTE: 13 // LTE NETWORK_TYPE_EHRPD: 14 // eHRPD NETWORK_TYPE_HSPAP: 15 // HSPA+ NETWORK_TYPE_GSM: 16 // GSM NETWORK_TYPE_TD_SCDMA: 17 // TD-SCDMA NETWORK_TYPE_IWLAN: 18 // IWLAN }
PhoneType = { PHONE_TYPE_NONE: 0 // none PHONE_TYPE_GSM: 1 // GSM PHONE_TYPE_CDMA: 2 // CDMA PHONE_TYPE_SIP: 3 // SIP }
SIMState = { SIM_STATE_UNKNOWN: 0 // Unknown. Signifies that the SIM is in transition between states. SIM_STATE_ABSENT: 1 // No SIM card is available in the device SIM_STATE_PIN_REQUIRED: 2 // Locked: requires the user's SIM PIN to unlock SIM_STATE_PUK_REQUIRED: 3 // Locked: requires the user's SIM PUK to unlock SIM_STATE_NETWORK_LOCKED: 4 // Locked: requires a network PIN to unlock SIM_STATE_READY: 5 // Ready }