且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获得无线网络的名称使用了Android的API的Andr​​oid?

更新时间:2022-10-23 18:00:51

android.net.wifi.WifiInfo.getSSID

I thought that I should use NetworkInterface::getDisplayName. I got some name, but this name is different that this name which I can see, when I choosing to which network I want to connect.

Please help..

[EDIT]

acording to Loxley answer:

WifiManager wifiMgr = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
String name = wifiInfo.getSSID();

android.net.wifi.WifiInfo.getSSID?