Android判断是否为Wifi网络
private static boolean isWifi(Context context) { ConnectivityManager connectivityManager =(ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo =connectivityManager.getActiveNetworkInfo(); if (activeNetworkInfo != null &&activeNetworkInfo.getType() == connectivityManager.TYPE_WIFI){ return true; } return false; }