阿里狼 发表于 2015-10-2 10:41:16

[Android]获取当前WIFI的ip地址

  配置清单文件加上权限



private String getLocalIpAddress() {
int paramInt = ((WifiManager) getSystemService("wifi")).getConnectionInfo().getIpAddress();
return (paramInt & 0xFF) + "." + (0xFF & paramInt >> 8) + "." + (0xFF & paramInt >> 16) + "."
+ (0xFF & paramInt >> 24);
}
  
页: [1]
查看完整版本: [Android]获取当前WIFI的ip地址