I am using this code for checking internet connectivity. It works fine and when the device is offline, the screen just blanks out. Is there a method to show some screen during the wait?
public boolean isConnected() throws InterruptedException, IOException {
String command = "ping -c 1 google.com";
return Runtime.getRuntime().exec(command).waitFor() == 0;
}
The source of this code is taken from
https://stackoverflow.com/questions/9570237/android-check-internet-connection
I have increased the number of ping packets and found that it is proportionally blanking out, nevertheless, the main screen appears after that. I'm using this code at the beginning (Main Activity) and it is sufficient for my app to check online connectivity at the beginning.