Java tutorial
//package com.java2s; import android.annotation.SuppressLint; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { @SuppressLint("DefaultLocale") public static boolean isWifi(Context context) { try { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm != null) { NetworkInfo nInfo = cm.getActiveNetworkInfo(); if (nInfo != null) { return nInfo.getTypeName().toUpperCase().equals("WIFI"); } } } catch (Exception e) { } return false; } }