import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
class Main {
public static boolean IsWiFiConnected(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getApplicationContext().getSystemService(
Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getTypeName().equals("WIFI")
&& info[i].isConnected())
return true;
}
}
}
return false;
}
}