question

01928-7325x2 avatar image
01928-7325x2 asked 01928-7325x2 commented

Cannot Make HTTP Call To Other Server

We release a new app and we found that http call from inside the app to our server doesn't work. Is Clover station blocking all outgoing HTTP request other than to Clover server? (HTTP call to Clover API is ok)

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

It would help a lot to know the error.

0 Likes 0 ·

1 Answer

Mark Mullan avatar image
Mark Mullan Deactivated answered 01928-7325x2 commented

Hi,

This is working fine for me on both Sandbox and Prod on Station.

public void makeHttpRequest(View view) {
    new AsyncTask<Void, Void, Response>() {
        protected final Response doInBackground(Void... params) {
            String url = "https://www.google.com";
            Request request = new Request.Builder()
                    .url(url)
                    .build();

            Response response = null;

            try {
                response = mClient.newCall(request).execute();
            } catch (Exception e) {
                e.printStackTrace();
            }

            if (response != null) {
                return response;
            }
            return null;
        }


        protected void onPostExecute(Response response) {
            if (response.isSuccessful()) {
                Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "Fail", Toast.LENGTH_LONG).show();
            }
        }
    }.execute();
}
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

01928-7325x2 avatar image 01928-7325x2 commented ·

Hmm weird... Ok could be my network environment problem or something else. Thanks!!

0 Likes 0 ·

Welcome to the
Clover Developer Community