TelephonyManagerCompat
class TelephonyManagerCompat
Helper for accessing features in TelephonyManager.
Summary
Public functions |
|
|---|---|
java-static String? |
@RequiresPermission(value = android.Manifest.permission.READ_PHONE_STATE)Returns the IMEI (International Mobile Equipment Identity) associated with the subscription id of the given TelephonyManager, or null if not available. |
java-static Int |
getSubscriptionId(telephonyManager: TelephonyManager)Return the subscription ID the TelephonyManager was created with (via |
Public functions
getImei
@RequiresPermission(value = android.Manifest.permission.READ_PHONE_STATE)
java-static fun getImei(telephonyManager: TelephonyManager): String?
Returns the IMEI (International Mobile Equipment Identity) associated with the subscription id of the given TelephonyManager, or null if not available.
Below Android 10, this API requires any of:
- the caller holds the READ_PHONE_STATE permission
- the caller has carrier privileges (see
hasCarrierPrivileges)
On Android 10 and above, this API requires any of:
- the caller holds the READ_PRIVILEGED_PHONE_STATE permission
- the caller is the device or profile owner and holds the READ_PHONE_STATE permission
- the caller has carrier privileges (see
hasCarrierPrivileges) - the caller is the default SMS role holder (see
isRoleHeld) - the caller holds the USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER permission
getSubscriptionId
java-static fun getSubscriptionId(telephonyManager: TelephonyManager): Int
Return the subscription ID the TelephonyManager was created with (via createForSubscriptionId) if applicable, and otherwise the default subscription ID.