public static boolean isCurrentConnectionWifi ( Context context ) { ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; if ( cm == null ) { return false ; } NetworkInfo info = cm . getActiveNetworkInfo ( ) ; return info != null && info . getType ( ) == ConnectivityManager . TYPE_WIFI ; }
Check if current connection is Wi - Fi .