downloadUrl在Firebase存储中为com.google.android.gms.tasks.zzu@5f9a842

问题描述 投票:0回答:1

作为Firebase存储中的Uri,我收到一个错误com.google.android.gms.tasks.zzu@5f9a842作为downloadUrl

private void StoringImageToFirebaseStorage(){

    Calendar calFordData = Calendar.getInstance();
    SimpleDateFormat currentDate = new SimpleDateFormat("dd-MMMM-yyyy");
    saveCurrentData = currentDate.format(calFordData.getTime());

    Calendar calFordTime = Calendar.getInstance();
    SimpleDateFormat currentTime = new SimpleDateFormat("HH:mm");
    saveCurrentTime = currentTime.format(calFordData.getTime());

    postRandomName = saveCurrentData + saveCurrentTime;

    StorageReference filePath = PostsImagesRefrence.child("Post Images").child(ImageUri.getLastPathSegment()+ postRandomName + ".jpg");

    filePath.putFile(ImageUri).addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() {
        @Override
        public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
            if (task.isSuccessful())
            {
                 String downloadUrl = task.getResult().getStorage().getDownloadUrl().toString();
                Toast.makeText(PostActivity.this, "Image uploaded successfully to storage", Toast.LENGTH_SHORT).show();

                SavingPostInformationToDatabase();
            }
            else{
                String message = task.getException().getMessage();
                Toast.makeText(PostActivity.this, "Error Occurred", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
java firebase
1个回答
0
投票
None
热门问题
推荐问题
最新问题