I'm very new to using web apis and am having trouble getting data in JSON format using Riot Games' API. Here's the code:
public void readJSONFeed(String address) throws IOException {
URL url = new URL(address);
JSONObject jsonResponse = null;
HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoInput(true);
urlConnection.setDoOutput(false);
urlConnection.connect(); //Crashes here
BufferedInputStream in = new BufferedInputStream(urlConnection.getInputStream());
I've marked where the code crashes (it works if you comment everything after and including that). I think the issue might be that the web service I'm using uses https and I don't know how to make the connection secure. I have added the internet permission to the manifest file.