getImei

open fun getImei(@NonNull telephonyManager: @NonNull TelephonyManager): @Nullable String(source)

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