title: How to add ApiKey and Token To HttpURLConnection
body: <p>I implemented an AsyncTask class that uploads an image. How should i add ApiKey and Token To HttpURLConnection instance? </p>
  
  <p>Voila the Code :</p>
  
  <pre><code>@SuppressLint("StaticFieldLeak")
  class UploadFileTask extends AsyncTask&lt;String, Void, String&gt; {
  
      @SuppressLint("LongLogTag")
      protected String doInBackground(String... urls) {
          try {
  
              HttpURLConnection conn;
  </code></pre>
  
  <p>//...</p>
  
  <pre><code>                    conn = (HttpURLConnection) url.openConnection();
                      conn.setDoInput(true); 
                      conn.setDoOutput(true); 
                      conn.setUseCaches(false); 
                      conn.setRequestMethod("POST");
                      conn.setRequestProperty("Connection", "Keep-Alive");
                      conn.setRequestProperty("ENCTYPE", "multipart/form-data");
                      conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
                      conn.setRequestProperty("uploaded_file", sourceFileUri);
  </code></pre>
  
  <p>//...</p>