title: How to log in automatically in Android to open WiFi that requires web user/password?
body: <p>In first place, I connect to the open Wifi programaticaly</p>
  
  <pre><code>public static boolean conectar(Context ctx, String user, String pass){
  
      boolean conectado = false;
  
      String networkSSID = "wifiguay.es";
  
      WifiConfiguration conf = new WifiConfiguration();
      conf.SSID = "\"" + networkSSID + "\"";   
  
      conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  
      WifiManager wifiManager = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE); 
      wifiManager.addNetwork(conf);
  
      List&lt;WifiConfiguration&gt; list = wifiManager.getConfiguredNetworks();
      for( WifiConfiguration i : list ) {
          if(i.SSID != null &amp;&amp; i.SSID.equals("\"" + networkSSID + "\"")) {
               wifiManager.disconnect();
               wifiManager.enableNetwork(i.networkId, true);
               wifiManager.reconnect();               
               conectado = true;
  
               break;
          }           
      }
  
      return conectado;
  }
  </code></pre>
  
  <p>Then, I detect if the open Wifi is "Wifiguay.es" and I open the browser to put the username and password.</p>
  
  <pre><code>public class ConexionEstablecida extends BroadcastReceiver  {
  
      public void onReceive(Context context, Intent intent) {
  
          NetworkInfo info = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
          if(info != null){
              if(info.isConnected()){
                  WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
                  WifiInfo wifiInfo = wifiManager.getConnectionInfo();
                  String ssid = wifiInfo.getSSID();
                  String networkSSID = "wifiguay.es";
  
                  if(ssid.equalsIgnoreCase("\"" + networkSSID + "\"")){
                      Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://wifiguay.lan/login?dst=http%3A%2F%2Fwww.google.es%2F"));    
                      i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                      context.startActivity(i);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Now, i don´t know how to do to put the data.</p>