1

我只想获取wifi热点的SSID。下面的代码片段足以获取当前的 wifi 热点名称,但我想要前一个。

try {
    WifiManager manager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    Method getWifiApConfigurationMethod = manager.getClass().getMethod("getWifiApConfiguration");
    WifiConfiguration  config = (WifiConfiguration) getWifiApConfigurationMethod.invoke(manager);
    Log.e("CLIENT", "SSID:" + config.SSID);
} catch (Exception e) {
    e.printStackTrace();
}

请帮忙...

4

0 回答 0