checkForCarrierPrivileges
unknown
java
3 years ago
675 B
10
Indexable
private fun checkForCarrierPrivileges() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
val tm = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
if (tm.hasCarrierPrivileges()) {
Toast.makeText(this, "hasCarrierPrivileges = true", Toast.LENGTH_SHORT).show()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
tm.uiccCardsInfo.forEachIndexed { index, uiccCardInfo ->
}
}
} else {
Toast.makeText(this, "hasCarrierPrivileges = false", Toast.LENGTH_SHORT).show()
}
}
}Editor is loading...