how can I download image on firebase storage?

后端 未结 5 491
难免孤独
难免孤独 2021-01-06 14:53

I want to download image on firebase storage in android app.

this is my image

I try this but it is not working

storageR         


        
5条回答
  •  伪装坚强ぢ
    2021-01-06 15:34

    Try this

    // Create a storage reference from our app
    StorageReference storageRef = storage.getReferenceFromUrl("gs://");
    
    // Create a reference with an initial file path and name
    StorageReference pathReference = storageRef.child("users/me/yourpics.png");
    
    
    
    storageRef.child("users/me/yourpics.png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
                @Override
                public void onSuccess(Uri uri) {
                    // Got the download URL for 'users/me/profile.png'
                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception exception) {
                    // Handle any errors
                }
            });
    

    Download-files

    https://firebase.google.com/docs/storage/android/download-files

提交回复
热议问题