Network Info
public class Network {
public static DhcpInfo getNetworkInfo(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
android.net.NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo();
switch (activeNetworkInfo.getType()) {
case ConnectivityManager.TYPE_ETHERNET:
return null;
case ConnectivityManager.TYPE_WIFI:
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
return wifi.getDhcpInfo();
default:
return null;
}
}
}