use of android.net.NetworkInfo in project k-9 by k9mail.
the class Utility method hasConnectivity.
/**
* Check to see if we have network connectivity.
*/
public static boolean hasConnectivity(final Context context) {
final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager == null) {
return false;
}
final NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();
if (netInfo != null && netInfo.getState() == NetworkInfo.State.CONNECTED) {
return true;
} else {
return false;
}
}
use of android.net.NetworkInfo in project Signal-Android by WhisperSystems.
the class MmsRadio method isConnected.
private boolean isConnected() {
NetworkInfo info = connectivityManager.getNetworkInfo(TYPE_MOBILE_MMS);
Log.w("MmsRadio", "Connected: " + info);
if ((info == null) || (info.getType() != TYPE_MOBILE_MMS) || !info.isConnected())
return false;
return true;
}
use of android.net.NetworkInfo in project Signal-Android by WhisperSystems.
the class OutgoingLegacyMmsConnection method isConnectionPossible.
public static boolean isConnectionPossible(Context context) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(MmsRadio.TYPE_MOBILE_MMS);
if (networkInfo == null) {
Log.w(TAG, "MMS network info was null, unsupported by this device");
return false;
}
getApn(context);
return true;
} catch (ApnUnavailableException e) {
Log.w(TAG, e);
return false;
}
}
use of android.net.NetworkInfo in project Klyph by jonathangerbaud.
the class ConnectionState method isOnline.
public boolean isOnline() {
try {
connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
connected = networkInfo != null && networkInfo.isAvailable() && networkInfo.isConnected();
return connected;
} catch (Exception e) {
Log.v("connectivity", e.toString());
}
return connected;
}
use of android.net.NetworkInfo in project Klyph by jonathangerbaud.
the class ConnectionState method isOnline.
public Boolean isOnline() {
try {
connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
connected = networkInfo != null && networkInfo.isAvailable() && networkInfo.isConnected();
return connected;
} catch (Exception e) {
Log.v("connectivity", e.toString());
}
return connected;
}
Aggregations