sim 卡管理
{ "name": "blueos.telephony.simManager" }import simManager from '@blueos.telephony.simManager' 或 const simManager = require('@blueos.telephony.simManager')simManager.getSimOperators(OBJECT)
Section titled “simManager.getSimOperators(OBJECT)”获取 Sim 卡的运营商信息
电话权限
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | Function | 否 | 成功回调 |
| fail | Function | 否 | 失败回调 |
| complete | Function | 否 | 执行结束后的回调 |
success 返回值:
Section titled “success 返回值:”| 参数名 | 类型 | 说明 |
|---|---|---|
| operators | Array | SIM 卡列表信息 |
| size | Number | Sim 卡数量 |
fail 返回错误代码:
Section titled “fail 返回错误代码:”| 错误码 | 说明 |
|---|---|
| 201 | 用户拒绝,获取电话权限失败 |
| 207 | 用户拒绝并勾选不再询问复选框 |
| 1001 | 未插入 sim 卡 |
| 1002 | 获取运营商信息失败 |
SIM 卡列表项参数:
Section titled “SIM 卡列表项参数:”| 参数名 | 类型 | 说明 |
|---|---|---|
| operator | String | 返回 Sim 卡的运营商信息 |
| 运营商信息说明:此处统一返回 MCC+MNC,即移动国家代码 + 移动网络代码; | ||
| 中国移动:46000,46002,46004,46007; | ||
| 中国联通:46001,46006,46009; | ||
| 中国电信:46003,46005,46011; | ||
| [其余 MCC+MNC](/api/system/<https:/www.mcc-mnc.com/ >) | ||
| slotIndex | Number | 卡槽序号 |
simManager.getSimOperators({ success(data) { console.log(`size: ${data.size}`) for (const i in data.operators) { console.log(`operator: ${data.operators[i].operator}, slotIndex:${data.operators[i].slotIndex}, isDefaultDataOperator:${data.operators[i].isDefaultDataOperator},`) } }, fail(data, code) { console.log(`handling fail, code = ${code}, errorMsg=${data}`) },})