1如何获得当前连接wifi热点手机对应的ip地址
String mAddress = "未取到地址";
WifiManager mWifiManager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE);
WifiInfo mWifiInfo = mWifiManager.getConnectionInfo();
int ipAddress = mWifiInfo.getIpAddress();
mAddress = android.text.format.Formatter.formatIpAddress(ipAddress);
此时获得的ip地址就是xx.xx.xx.xx所表示的ip地址
需要如下权限:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
参考自:http://blog.csdn.net/Android_Tutor/article/details/5576544