How to attach request parameters to current Android HttpUrlConnection call
<p>I am able to send a request from an Android program to a remote server, but it seems the request has no parameters.  How do I attach parameters?</p>

<p>Here is my current code:</p>

<pre><code>    @Override
    protected String doInBackground(String... theParams) 
    {

        String myUrl = theParams[0];
        final String myEmail = theParams[1];
        final String myPassword = theParams[2];

        Authenticator.setDefault(new Authenticator()
        {
            protected PasswordAuthentication getPasswordAuthentication() 
            {
                return new PasswordAuthentication( myEmail, myPassword.toCharArray());
            }
        });         

        String response = null;

        try 
        {
            final URL url = new URL(myUrl);

            final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty("login", myEmail);
            conn.setRequestProperty("password", myPassword);

            conn.setUseCaches(false);

            final InputStream is = conn.getInputStream();
            final byte[] buffer = new byte[8196];
            int readCount;
            final StringBuilder builder = new StringBuilder();
            while ((readCount = is.read(buffer)) &gt; -1) 
            {
                builder.append(new String(buffer, 0, readCount));
            }

                response = builder.toString();      
            Log.d( "After call, response: " , " " + response);
        } 
        catch (Exception e) 
        {

        }

        return response;
    }
</code></pre>

<p>So now I am not sure how to make the Authenticator password/login get attached to the request and get sent to the server. Any idea how I can accomplish that?</p>

<p>Thanks!</p>
