Do you suspect it is blocking here in the loop() if there is no connection ?
I don't know this particular platform, but I guess these callback routines are stubs:
void onNetworkError() {
Serial.println(">>>> ERROR");
}
and would probably be a good place to set global variables which you can test in the loop() to see if it is safe to start attempting to make a connection to the "cloud".