Search code examples
androiduniversal-image-loader

Using UniversalImageLoader with authorization


In my app, some of images are protected by authorization layer.

Downloading process is:

  1. Try download image from uri
  2. If failed on authorization get authorized uri and try again.

The problems are:

  1. There are no retry method, so I cannot try again with new uri
  2. Images are cached by uri (?) so I cannot save image from authorized uri as it was from base not authorized uri, so my authorized images will always be redownloaded.

Is there any way to resolve it in some simple way?


Solution

  • You should implement your own ImageDownloader (it's better to extend BaseImageDownloader) which will handle this case. It should check if auth is required and it is then it makes re-query.