其實很簡單,可以使用wifimanager和wifiinfo來獲取當前wifi連線資訊
wifimanager wifimanager = (wifimanager) getsystemservice(wifi_service);
wifiinfo wifiinfo = wifimanager.getconnectioninfo();
log.d("wifiinfo", wifiinfo.tostring());
log.d("ssid",wifiinfo.getssid());
manifest檔案中需要新增許可權許可
如果不是想獲取當前連線,而是想獲取wifi設定中的連線,可以使用
wifimanager.getconfigurednetworks()
Android如何獲取Wifi名稱即SSID
可以使用wifimanager和wifiinfo來獲取當前wifi連線資訊 wifimanager wifimanager wifimanager getsystemservice wifi service wifiinfo wifiinfo wifimanager.getconnectioninf...
android獲取系統wifi狀態等
wifi 獲取wifi狀態 wifimanager wifimanager wifimanager context.getsystemservice context.wifi service if wifimanager null 附 wifi狀態有以下幾種 括號內為所對應的的int值 1.wifi...
Android工具類 獲取wifi模組MAC位址
public class macutil else if build.version.sdk int build.version codes.m build.version.sdk int build.version codes.n else if build.version.sdk int bui...