In my calling app I have address book with profile pictures. These pictures are used on different screens and also in incoming call notifications. Since notification's RemoteViews have to be provided with Bitmap before they appear on screen, and corresponding http request can take fair amount of time, I want to load image to the notification's RemoteViews only if it's available in cache.
Is there a way to force Glide to load images only from cache and never from network?
If it is possible to load and render an image after notification appear, I would be grateful for such solution too.
Found the way in documentation:
Loading only from cache In some circumstances you may want a load to fail if an image is not already in cache. To do so, you can use the onlyRetrieveFromCache method on a per request basis:
Glide.with(fragment)
.load(url)
.onlyRetrieveFromCache(true)
.into(imageView);
If the image is found in the memory cache or in the disk cache, it will be loaded. Otherwise, if this option is set to true, the load will fail.