question

ydev avatar image
ydev asked ·

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 characters needed characters left characters exceeded

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

It would help a lot to know the error.

0 Likes 0 · ·

1 Answer

Mark Mullan avatar image
Mark Mullan answered ·

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 Share
10 |2000 characters needed characters left characters exceeded

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

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

0 Likes 0 · ·

Welcome to the
Clover Developer Community