You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.
Currently I develop a movie app which loads a lot of cover images. Especially in the overview where I show the cover images in a grid and the app has to load lots of images in parallel.
Should I start / stop sampling for every image request or can I start sampling with app start and stop it when the app goes to background?
Currently I have a NetworkInterceptor for OkHttp to do start / stop but I'm not sure if it is a good idea :-(
private static class DeviceBandwidthSamplerInterceptor implements Interceptor {
private final DeviceBandwidthSampler deviceBandwidthSampler;
DeviceBandwidthSamplerInterceptor(final DeviceBandwidthSampler deviceBandwidthSampler) {
this.deviceBandwidthSampler = deviceBandwidthSampler;
}
@Override
public Response intercept(final Chain chain) throws IOException {
deviceBandwidthSampler.startSampling();
final Response response = chain.proceed(chain.request());
deviceBandwidthSampler.stopSampling();
return response;
}
}
The text was updated successfully, but these errors were encountered:
Hi @the4thfloor , @shobhitpuri : You should start sampling when it comes to foreground, and stop it when it goes into background. The larger the HTTP transfers that occur between the start() and stop(), the better the odds that you don't have an "UNKNOWN" estimate.
In case your app requires quick sampling to tune video quality defaults or image loading strategies, you can also try the library that I have built : https://getfastah.com/docs/api . Since it uses its own geographically distributed ping-server network, it does a much better job estimating WiFi or 4G congestion accurately (and very fast). It's a paid API, in private beta at the moment.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently I develop a movie app which loads a lot of cover images. Especially in the overview where I show the cover images in a grid and the app has to load lots of images in parallel.
Should I start / stop sampling for every image request or can I start sampling with app start and stop it when the app goes to background?
Currently I have a NetworkInterceptor for OkHttp to do start / stop but I'm not sure if it is a good idea :-(
The text was updated successfully, but these errors were encountered: