Get System Wifi Ip Address
//package edu.umich.jezzball.net;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
class Utility
{
static final int IP_ADDRESS_LENGTH = 32;
public static Integer getSystemWifiIpAddress(Context context)
{
WifiManager wManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wInfo = wManager.getConnectionInfo();
int ipAddress = wInfo.getIpAddress();
if (ipAddress == 0)
return null;
return ipAddress;
}
}
Related examples in the same category