Important is this line:
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
which seems to reset the settings. My ESP32 showed up as "Espressif"
B4X:
Private Sub SetHostName
Dim bb() As Byte = "TheHostname"
RunNative("SetHostName", bb)
End Sub
#if C
void...