|
@@ -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) {
|
|
|
|
- var msg = ""
|
|
|
|
- when (telManager.simState) {
|
|
|
|
- TelephonyManager.SIM_STATE_ABSENT -> {
|
|
|
|
- msg = "Cannot use without Sim card."
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- TelephonyManager.SIM_STATE_PIN_REQUIRED -> {
|
|
|
|
- msg = "Sim card status locked, requires PIN code unlocking."
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- TelephonyManager.SIM_STATE_PUK_REQUIRED -> {
|
|
|
|
- msg = "Sim card status locked, requires PUK code unlocking."
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- TelephonyManager.SIM_STATE_NETWORK_LOCKED -> {
|
|
|
|
- msg = "Sim card status is locked and requires a network PIN code to unlock."
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- else -> {
|
|
|
|
- msg = "The Sim card is in an abnormal state and cannot be used."
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- AlertView(
|
|
|
|
- "",
|
|
|
|
- msg,
|
|
|
|
- null,
|
|
|
|
- arrayOf("Confirm"),
|
|
|
|
- null,
|
|
|
|
- mContext,
|
|
|
|
- AlertView.Style.Alert
|
|
|
|
- ) { _, _ ->
|
|
|
|
- finish()
|
|
|
|
- }.show()
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
|
|
+// if (telManager.simState != TelephonyManager.SIM_STATE_READY) {
|
|
|
|
+// var msg = ""
|
|
|
|
+// when (telManager.simState) {
|
|
|
|
+// TelephonyManager.SIM_STATE_ABSENT -> {
|
|
|
|
+// msg = "Cannot use without Sim card."
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// TelephonyManager.SIM_STATE_PIN_REQUIRED -> {
|
|
|
|
+// msg = "Sim card status locked, requires PIN code unlocking."
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// TelephonyManager.SIM_STATE_PUK_REQUIRED -> {
|
|
|
|
+// msg = "Sim card status locked, requires PUK code unlocking."
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// TelephonyManager.SIM_STATE_NETWORK_LOCKED -> {
|
|
|
|
+// msg = "Sim card status is locked and requires a network PIN code to unlock."
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// else -> {
|
|
|
|
+// msg = "The Sim card is in an abnormal state and cannot be used."
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// AlertView(
|
|
|
|
+// "",
|
|
|
|
+// msg,
|
|
|
|
+// null,
|
|
|
|
+// arrayOf("Confirm"),
|
|
|
|
+// null,
|
|
|
|
+// mContext,
|
|
|
|
+// AlertView.Style.Alert
|
|
|
|
+// ) { _, _ ->
|
|
|
|
+// finish()
|
|
|
|
+// }.show()
|
|
|
|
+//
|
|
|
|
+// } 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()
|
|
- }
|
|
|
|
|
|
+// }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|