MCC 默认值

这个提交包含在:
徐勤民 2024-07-26 16:43:15 +08:00
父节点 5ade899336
当前提交 1b786203e3

查看文件

@ -142,45 +142,45 @@ class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
super.initData() super.initData()
val telManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager val telManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager
val simOperator = telManager.simOperator val simOperator = telManager.simOperator
if (telManager.simState != TelephonyManager.SIM_STATE_READY) { // if (telManager.simState != TelephonyManager.SIM_STATE_READY) {
var msg = "" // var msg = ""
when (telManager.simState) { // when (telManager.simState) {
TelephonyManager.SIM_STATE_ABSENT -> { // TelephonyManager.SIM_STATE_ABSENT -> {
msg = "Cannot use without Sim card." // msg = "Cannot use without Sim card."
} // }
//
TelephonyManager.SIM_STATE_PIN_REQUIRED -> { // TelephonyManager.SIM_STATE_PIN_REQUIRED -> {
msg = "Sim card status locked, requires PIN code unlocking." // msg = "Sim card status locked, requires PIN code unlocking."
} // }
//
TelephonyManager.SIM_STATE_PUK_REQUIRED -> { // TelephonyManager.SIM_STATE_PUK_REQUIRED -> {
msg = "Sim card status locked, requires PUK code unlocking." // msg = "Sim card status locked, requires PUK code unlocking."
} // }
//
TelephonyManager.SIM_STATE_NETWORK_LOCKED -> { // TelephonyManager.SIM_STATE_NETWORK_LOCKED -> {
msg = "Sim card status is locked and requires a network PIN code to unlock." // msg = "Sim card status is locked and requires a network PIN code to unlock."
} // }
//
else -> { // else -> {
msg = "The Sim card is in an abnormal state and cannot be used." // msg = "The Sim card is in an abnormal state and cannot be used."
} // }
} // }
AlertView( // AlertView(
"", // "",
msg, // msg,
null, // null,
arrayOf("Confirm"), // arrayOf("Confirm"),
null, // null,
mContext, // mContext,
AlertView.Style.Alert // AlertView.Style.Alert
) { _, _ -> // ) { _, _ ->
finish() // finish()
}.show() // }.show()
//
} else { // } else {
putString(DEVICE_ID, DeviceUuidFactory(mContext).deviceUuid.toString()) putString(DEVICE_ID, DeviceUuidFactory(mContext).deviceUuid.toString())
// putString(DEVICE_ID, DeviceUuidFactory(mContext).deviceUuid.toString()+"test111_"+ Random(2).toString()) // putString(DEVICE_ID, DeviceUuidFactory(mContext).deviceUuid.toString()+"test111_"+ Random(2).toString())
putString(MCC, simOperator.substring(0, 3)) putString(MCC, if(telManager.simState == TelephonyManager.SIM_STATE_READY) simOperator.substring(0, 3) else "-1")
vm.result.observe(this) { vm.result.observe(this) {
it?.also { it?.also {
@ -221,7 +221,7 @@ class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
} }
} }
vm.init() vm.init()
} // }
} }