Add method checkNetwork() to detect offline mode