使用 WifiWizard2 连接 wifi 后,设备 wifi 上显示十字标记,而 ionic 5 项目上没有互联网

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

我用 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 });
});

}

来自应用程序和互联网的成功互联网连接应该在应用程序之外工作

ionic-framework ionic4 ionic5
© www.soinside.com 2019 - 2024. All rights reserved.