title: OpenSubtitles api android class
body: <p>I'm having trouble getting data from OpenSubtitles api. I have looked at many examples for java and python. Below is the class I'm trying to use to authenticate with OpenSubtitles api. After that I want to make request that will return a list of items I can pass to my recyclerview.</p>
  
  <pre><code>package com.shivito.subreader;
  
  import android.app.DownloadManager;
  import android.os.Build;
  import android.os.Handler;
  import android.util.Log;
  
  import androidx.annotation.RequiresApi;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLConnection;
  import java.util.Base64;
  import java.util.Map;
  
  import javax.net.ssl.HttpsURLConnection;
  
  public class OpensubsRequest {
      static String username;
      static String password;
      static String language;
      static String useragent;
      @RequiresApi(api = Build.VERSION_CODES.O)
      public static void makerequest(){
  
          Thread thread = new Thread() {
              @Override
              public void run() {
                  try {
                      Log.d("here","nope");
                      URL Opensubs = new URL("https://api.opensubtitles.org/xml-rpc");
                      URL url = new URL("https", "api.opensubtitles.org", 443, "/xml-rpc");
                      URLConnection uc = Opensubs.openConnection();
                      Log.d("working",uc.toString());
                      uc.addRequestProperty("username",username);
                      uc.addRequestProperty("password",password);
                      uc.addRequestProperty("language",language);
                      uc.addRequestProperty("useragent",useragent);
                      uc.connect();
                      Log.d("anythingnow", String.valueOf(uc.getAllowUserInteraction()));
  
                  } catch (MalformedURLException e) {
                      e.printStackTrace();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
          };
          thread.start();
      }
  }
  </code></pre>
  
  <p>Okay so in the above class I am trying to send my login information to the api then I try to check if it was successful by reading the response from(uc.getAllowUserInteraction()). Up to this point it always says false. Of course I'm likely not doing this right and I hope someone can point me in the right direction. Thank you!!</p>