I think you have the right idea here. Storing the URL (that you get from the Storage Metadata) in Firebase Database is a great way to have it ready to load via Glide when you are populating your RecyclerView. It's a technique I have used before and it works well. If you also store some basic information about the image (such as the size) you can pre-size the ImageView while Glide loads the image, which will make your UI less jumpy.
Regarding access controls, the URLs generated by FirebaseStorage are publicly accessible so if you store them in FIrebase Database you should make sure you have the appropriate security rules on those paths. If that's something you're worried about, you could do the following:
/**
* ModelLoader implementation to download images from FirebaseStorage with Glide.
*
* Sample Usage:
* <pre>
* StorageReference ref = FirebaseStorage.getInstance().getReference().child("myimage");
* ImageView iv = (ImageView) findViewById(R.id.my_image_view);
*
* Glide.with(this)
* .using(new FirebaseImageLoader())
* .load(ref)
* .into(iv);
* </pre>
*/
public class FirebaseImageLoader implements StreamModelLoader<StorageReference> {
@Override
public DataFetcher<InputStream> getResourceFetcher(StorageReference model, int width, int height) {
return new FirebaseStorageFetcher(model);
}
private class FirebaseStorageFetcher implements DataFetcher<InputStream> {
private StorageReference mRef;
FirebaseStorageFetcher(StorageReference ref) {
mRef = ref;
}
@Override
public InputStream loadData(Priority priority) throws Exception {
return Tasks.await(mRef.getStream()).getStream();
}
@Override
public void cleanup() {
// No cleanup possible, Task does not expose cancellation
}
@Override
public String getId() {
return mRef.getPath();
}
@Override
public void cancel() {
// No cancellation possible, Task does not expose cancellation
}
}
}