code: @SuppressLint("HardwareIds")
    public static String getDeviceId(Context context) {
      String androidId = getString(context.getContentResolver(), ANDROID_ID);
      if (!isNullOrEmpty(androidId)
          && !"9774d56d682e549c".equals(androidId)
          && !"unknown".equals(androidId)
          && !"000000000000000".equals(androidId)) {
        return androidId;
      }
  
      // Serial number, guaranteed to be on all non phones in 2.3+.
      if (!isNullOrEmpty(Build.SERIAL)) {
        return Build.SERIAL;
      }
  
      // Telephony ID, guaranteed to be on all phones, requires READ_PHONE_STATE permission
      if (hasPermission(context, READ_PHONE_STATE) && hasFeature(context, FEATURE_TELEPHONY)) {
        TelephonyManager telephonyManager = getSystemService(context, TELEPHONY_SERVICE);
        @SuppressLint("MissingPermission")
        String telephonyId = telephonyManager.getDeviceId();
        if (!isNullOrEmpty(telephonyId)) {
          return telephonyId;
        }
      }
  
      // If this still fails, generate random identifier that does not persist across installations
      return UUID.randomUUID().toString();
    }
docs: Creates a unique device id. Suppresses `HardwareIds` lint warnings as we don't use this ID for
  identifying specific users. This is also what is required by the Segment spec.