@API(status = STABLE)
public class NetworkUtilConstructors
public NetworkUtil()Methods
public static void ensureOnline(String action) throws NoConnectionExceptionEnsures that the user has a working internet connection
The result is remembered for a few seconds
Example usage:
try {
NetworkUtil.ensureOnline("Login");
// proceed with network operation
} catch (NoConnectionException e) {
// show/print a human readable message
System.out.println("You do not have a network connection");
}| Parameters | ||
|---|---|---|
action | String | A short description of the action that requires connectivity, e.g. "Login" |
| Throws | ||
NoConnectionException | If there is no connection | |