coderror
coderror

Reputation: 97

Android: Http request fails in wifi connection

I have an issue with HTTPS requests. I do not know why? But I have been observing that in the same wifi(mobile hotspot) youtube and Instagram loads very well. But in my app, I have tried Picasso, Glide, OkHttp, HttpURLConnection, etc. These all take time to get a response. I have a list of 20 image URLs all are CDN(if I open these URLs in the browser it takes max 40ms or less, if the internet connection is very slow then takes 1-2sec). When I connect to another mobile hotspot Picasso, Glide, OkHttp, and HttpURLConnection take a lot of time, which means more than 20 sec, after 20 sec the mobile data speed suddenly goes up to Mbps and it loads all the images but at the same time, Instagram & youtube maintain the consistent internet connection and my main issue is, why the first response takes time? but at the same time, Instagram & youtube works very well.

ERROR

 class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1

Yes I'm getting the issue when I connect to that specific mobile hotspot. When I connect to other hotspots it works well. But I have a doubt How do Instagram & youtube manage to achieve good speed?

Are there any techniques to force hardware or any kind of different code they are using?

Upvotes: 1

Views: 119

Answers (0)

Related Questions