除了密码 cordova wifi 之外的每个 wifi 网络验证

each wifi network validation except password cordova wifi

我已经使用 wifiwizard 和 cordova 为 android 设备开发了 wifi 应用程序,它运行良好。我可以选择网络,输入密码,验证并连接进去。但问题是我的公司得到了一些额外的验证,比如身份证号码、员工类型和其他一些细节。那么我应该如何做这些事情或如何为特定网络添加这些东西。我已经上传了我的整个 wifi 应用程序,它完全符合我的预期。请大家看看,帮我做得更好

index.html

<!DOCTYPE html>
    <head>
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <title>Wifi Wizard</title>
    </head>
    <body>
      <div class = "content">   
                <table id = "displayNetworks" class = "table-responsive">

                </table>
      </div>
        <script type="text/javascript" src="js/jquery-1.12.4.js"></script> 
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/app.js"></script>
    </body>
</html>

app.js

var unique_array = [];

$(document).ready(function(){
    if(navigator.userAgent.match(/(iPhone|iPad|iPod|Android|BlackBerry)/)){
        document.addEventListener("deviceready", onDeviceReady, false);
    }else{
        onDeviceReady();
    }
});

function onDeviceReady(){
    alert("I'm into the browser for debug");
    window.setTimeout(function(){
        WifiWizard.setWifiEnabled(true, win_enable, fail_enable);
    }, 200);
}

function win_enable(){
    alert("Wifi Enabled successfully");
}

function fail_enable(e){
    alert(e.message);
}

window.setTimeout(function(){ alert("I'm in here");
        WifiWizard.startScan(success_scan, fail_scan);
}, 1000);


function success_scan(){ alert("Trying to connect scan function");
    window.setTimeout(function(){
        getScanResult();
    }, 2000);
}

function fail_scan(e){
    alert(e.message);
}

function getScanResult(){alert("Im here too getting the scan result");
    WifiWizard.getScanResults(listHandler, fail_network);
}

function listHandler(a){
    alert(JSON.stringify(a));
    var network_array = [];
    for(var i = 0; i < a.length; i++){
        network_array.push(a[i].SSID);
    }
    unique_array = network_array.filter(function(elem, pos){
        return network_array.indexOf(elem) == pos;
    });
    alert(network_array);
    var content = "<table>"
     for(var j = 0; j < network_array.length; j++){
          content += '<tr class="dynamicTable"><td><a href="javascript:void(0);" onclick="clickWifi(\'' + network_array[j] + '\');">' + network_array[j] + '</a></td></tr>';
     }
     content += "</table>"
     document.getElementById('displayNetworks').innerHTML = content;
}

function fail_network(e){
    alert(e.message);
}

function clickWifi(netssid){ alert("Hello Im inside click function");
    var id = netssid;
    alert(id);
    var promptWindow = prompt("Please enter the password for the network: " + id);
    alert(promptWindow);
    var connectWifi = WifiWizard.formatWPAConfig(id, promptWindow);
        WifiWizard.addNetwork(connectWifi, function(){
            WifiWizard.connectNetwork(id, connectSuccess, connectFailed);
        });
}

function connectSuccess(e){
    alert("Connected Successfully");
    window.open("http://www.google.com", "_self");
}

function connectFailed(e){
    alert(e.message);
}

而且我在函数 connectSuccess 中遇到了 window.open 的问题,window.open 在我的应用程序中不起作用,如果我退出我的应用程序,我可以到达 Google.

config.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.wifiexpandables353717" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <name>WifiExpandables</name>
  <description>
        An Ionic Framework and Cordova project.
    </description>
  <author email="you@example.com" href="http://example.com.com/">
      Your Name Here
    </author>
  <content src="index.html"/>
  <access origin="*"/>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="SplashScreenDelay" value="2000"/>
  <preference name="FadeSplashScreenDuration" value="2000"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreen" value="screen"/>
  <feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" onload="true"/>
  </feature>
  <platform name="android">
    <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
    <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
    <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
    <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
    <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
    <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
    <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
  </platform>
</widget>

在 config.xml 中添加以下行。它应该可以正常工作。

<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
   <allow-intent href="market:*" />
</platform>
<platform name="ios">
   <allow-intent href="itms:*" />
   <allow-intent href="itms-apps:*" />
</platform>