Search code examples
androidpicasso

Square's Picasso Retry Mechanism in Android


Does Picasso have a retry mechanism when failed to download images from web ?

I've noticed at their website that they mentioned a 3 times retry until error placeholder is shown.

I currently do not use placeholder (not for error and not while waiting for the image to download).

Is there a way to configure that myself when building Picasso object ?

I'm using the Picasso.with(...).load(...).into(...) builder.


Solution

  • Retrying is not done by Picasso, but the http client that performs the downloading requests. If you are using default OkHttpDownloader your client must be setting retry flag for OkHttpClient, i.e okHttpClient.setRetryOnConnectionFailure(true).

    Alternatively, use Interceptor and count the number of retries until the request is executed successfully.