【发布时间】:2019-09-15 12:04:15
【问题描述】:
移动国家代码由三位十进制数字组成,移动网络代码由两位或三位十进制数字组成(例如:001的MNC与01的MNC不同)https://en.wikipedia.org/wiki/Mobile_country_code
因此,将 MCC + MNC 作为字符串 how do you get the phone's MCC and MNC in Android? 可用于 SIM 卡插槽的主服务小区。
但是,我需要相邻单元格的这些值。
telephonyManager::getAllCellInfo
返回每个都很好地保存此信息的单元格列表(理论上),但我无法访问它。
我现在的minSdkVersion=26.
getAllCellInfo()!!.mapNotNull { cell ->
when (cell) {
is CellInfoGsm -> {
println(cell.cellIdentity.mcc)
println(cell.cellIdentity.mccString) // only available from 28 onwards
}
}
}
...
地点:
-
cell.cellIdentity.mcc已弃用 -
cell.cellIdentity.mcc返回一个整数。 IE。我错过了任何领先的0数字。
如何保存这些信息以准确找到合适的 MCC/MNC?
【问题讨论】:
标签: android kotlin mobile mobile-country-code