1、获得WifiManager对象WifiManager wm = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
2、通过WifiManager对象获得wifi信息WifiInfo info = wm.getConnectionInfo();
3、通过WifiInfo获得wifi信息//通过wifi管理对象获得wifi信息
WifiInfo info = wm.getConnectionInfo();
//获取wifi名称
String ssid = info.getSSID().replace("\"", "");
//获取mac地址
String MacAddr = info.getMacAddress();
//获取当前连接速度
int linkSpeed = info.getLinkSpeed();
//获取ip地址
int ipAddr = info.getIpAddress();
......
xml代码<?xml version="1.0" encoding="utf-8"?>
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent&#