在Windows(Cordova)上获取Wifi信息

问题描述 投票:0回答:1

我一直使用https://github.com/parsonsmatt/WifiWizard在iOS和Android上获取Wifi信息(特别是连接的SSID),这很棒。该插件不支持Windows / Windows Phone,但是,有什么方法可以在Windows或Windows Phone上看到连接的Wifi SSID的名称吗?

javascript windows cordova cordova-plugins
1个回答
0
投票
function getWifiSsid() {
    if (device.platform === 'windows') {
        let profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
        if (!profile) {
            throw 'No network connected';
        }
        if (profile.isWlanConnectionProfile && profile.wlanConnectionProfileDetails) {
            return profile.wlanConnectionProfileDetails.getConnectedSsid();
        } else {
            throw 'Wlan not connected';
        }
    } else {
        // todo
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.