public boolean checkConnection() { // this.runOnUiThread(new Runnable() { // // @Override // public void run() { // wifi is connected to correct xfinitywifi hotspot -- assuming // now do the web login -- not sure exactly how though... mWebView.loadUrl("http://wifilogin.comcast.net/wifi/xwifi.php"); // test for redirection String js_string = "<script> document.getElementById(\"username\").value = \"john_rula\"; document.getElementById(\"password\").value = FullHand3; document.getElementById(\"sign_in\").submit(); </script>"; mWebView.loadData(js_string, "text/html", "utf-8"); // } // // }); boolean connected = false; ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); // waitfor siginal int sleep_count = 0; while (!connected) { // need to check for route to host // do I need a landmark server on hinckley (echo?) String res = Remote.getString("http://config.aqualab.cs.northwestern.edu/data/alice/connect_test"); if (res == null || !res.equals("true")) { try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { connected = true; break; } if (sleep_count >= 5) { break; } sleep_count++; } if (!connected) { currentResult.error = "Unable to log in with comcast credentials"; return false; } // TODO some sort of automatic connecting // not sure what though -- browser scripting -- can we do that with webview? (yes?) // run tests return connected; }