我用 WifiWizard2 连接了 wifi。从 ionic 应用程序连接,但没有互联网工作。
async connectToNetworkWifiWizard2(ssid:字符串,密码:字符串,WPA2){ console.log('connectToNetworkWifiWizard2', { ssid, password, WPA2 });
return new Promise(async (resolve) => {
const formatWPAConfig = await WifiWizard2.formatWPAConfig(
ssid,
password,
true
);
console.log('formatWPAConfig', formatWPAConfig);
const WifiWizard2Add = await WifiWizard2.add(formatWPAConfig);
console.log('WifiWizard2Add', WifiWizard2Add);
const result = await WifiWizard2.connect(
ssid,
true,
password,
WPA2,
true
);
console.log('result indise platform', result);
const getConnectionInfo = await this.hotspot.getConnectionInfo();
const canConnectToInternet = await WifiWizard2.canConnectToInternet();
console.log('canConnectToInternet', canConnectToInternet);
this.wifiSsid = getConnectionInfo;
resolve({ result, connectedWifi: this.wifiSsid, canConnectToInternet });
});
}
来自应用程序和互联网的成功互联网连接应该在应用程序之外工作