Ibernato93 Ibernato93 - 1 month ago 19
Android Question

Picture for all users in my app

I'm developing an Android social app and I'm using Firebase authentication with email and password.
Now I would like that users can insert various images in their profile.
How do I save several images?
I would like to be able to distinguish each user profile images as follows: user1/profile/, user1/diary/, user2/profile/, user2/diary, ......

Answer

You'll have to use Firebase Storage.

Here is a snippet for the getting of the images, the upload would have to follow the same path pattern

StorageReference mStorage = FirebaseStorage.getInstance().getReference();

mStorage.child("some_path").child("user_id").child(fileName("profile"/"diary"/"etc").getDownloadUrl().addOnCompleteListener(onCompleteListener).addOnFailureListener(onFailureListener);