checkForCarrierPrivileges

mail@pastecode.io avatar
unknown
java
2 years ago
675 B
5
Indexable
Never
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()
            }
        }
    }