Android ION timeout error

485 Views Asked by At

since 2 days I have a dramatic trouble with my app: every time I try to get json values from my endpoint I get a timeout client error.

for(int i =1; i < 1000; i++){
     ArrayList<Product> products = Ion.with(mContext)
                        .load("GET",  url+i)
                        .setLogging("[PRODUCT]", Log.VERBOSE)
                        .setHeader("Content-Type", "application/json")
                        .as(new TypeToken<ArrayList<Product>>(){})
                        .get();
..........

I try to set timeout header or to set up getting timeout like below

for(int i =1; i < 1000; i++){
         ArrayList<Product> products = Ion.with(mContext)
                            .load("GET",  url+i)
                            .setTimeout(30000)
                            .setLogging("[PRODUCT]", Log.VERBOSE)
                            .setHeader("Content-Type", "application/json")
                            .as(new TypeToken<ArrayList<Product>>(){})
                            .get(30000, TimeUnit.MILLISECONDS);
    ..........

but I still have the same problem.

I can't understand how to solve this problem. Have you any suggestions?

0

There are 0 best solutions below