.getDownloadUrl无法运行Android Firebase

时间:2018-06-11 22:52:33

标签: android firebase android-studio firebase-storage

由于某种原因,.getDownloadUrl显示为红色且无效。

private void executeUploadTask(){

    Toast.makeText(getActivity(), "Uploading Image", Toast.LENGTH_SHORT).show();
    final String postId = FirebaseDatabase.getInstance().getReference().push().getKey();
    final StorageReference storageReference = FirebaseStorage.getInstance().getReference()
            .child("uploads/users" + FirebaseAuth.getInstance().getCurrentUser()
                    .getUid()+"/" + postId + "/upload_image");

    UploadTask uploadTask = storageReference.putBytes(mUploadBytes);
    uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
        @Override
        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
            Toast.makeText(getActivity(), "Filed", Toast.LENGTH_SHORT).show();

            Uri firebaseUri = taskSnapshot.getDownloadUrl();

            Log.d(TAG, "onSuccess: firebase download url: " + firebaseUri.toString());

            DatabaseReference reference = FirebaseDatabase.getInstance().getReference();

0 个答案:

没有答案