How to get FireStorage image?

0

I would like to get the image I sent to firestorage

CadastroActivity:

private void setPerfil(final String nome, final Uri foto) {
    StorageReference mStorage = FirebaseStorage.getInstance().getReference().child("Perfis");
    final StorageReference mImageFilePath = mStorage.child(pickedImgUri.getLastPathSegment());
    mImageFilePath.putFile(pickedImgUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
        @Override
        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
            mImageFilePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                @Override
                public void onSuccess(Uri uri) {
                    UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
                            .setDisplayName(nome)
                            .setPhotoUri(uri)
                            .build();
                    currentUser.updateProfile(profileUpdates).addOnCompleteListener(new OnCompleteListener<Void>() {
                        @Override
                        public void onComplete(@NonNull Task<Void> task) {
                            updateUI();
                        }
                    });
                }
            });
        }
    });
}

MainActivity:

private void setPerfil() {
    FirebaseStorage mStorage = FirebaseStorage.getInstance();
    Log.i("Danrley", "Oi, " + mAuth.getCurrentUser().getPhotoUrl());
    final StorageReference mImageFilePath = mStorage.getReferenceFromUrl(mAuth.getCurrentUser().getPhotoUrl().toString());
    mImageFilePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {
            Log.i("Danrley", "Oi, 2 " + uri);
            perfil.setImageURI(uri);
        }
    });
}

mAuth.getCurrentUser (). getPhotoUrl ():

link

onSucess uri:

link

    
asked by anonymous 22.11.2018 / 17:11

0 answers