Search in sources :

Example 1 with FirebaseStorage

use of com.google.firebase.storage.FirebaseStorage in project OnlineCanteen by josephgunawan97.

the class AccountUtil method uploadProfilePicture.

private static UploadTask uploadProfilePicture(Uri profilePictureUri) {
    FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
    FirebaseStorage storage = FirebaseStorage.getInstance();
    StorageReference storageReference = storage.getReference();
    StorageReference directoryReference = storageReference.child("profilepics");
    StorageReference profilePictureReference = directoryReference.child(firebaseUser.getUid() + ".jpg");
    if (profilePictureUri != null) {
        return profilePictureReference.putFile(profilePictureUri);
    } else
        return null;
}
Also used : StorageReference(com.google.firebase.storage.StorageReference) FirebaseStorage(com.google.firebase.storage.FirebaseStorage) FirebaseUser(com.google.firebase.auth.FirebaseUser)

Aggregations

FirebaseUser (com.google.firebase.auth.FirebaseUser)1 FirebaseStorage (com.google.firebase.storage.FirebaseStorage)1 StorageReference (com.google.firebase.storage.StorageReference)1