Firebase Storage's getDownloadUrl() method cannot be resolved


Neeraj Sewani

To upload images to Firebase Storage, attach to a StorageReference instance . When I override the method, the instance I am calling , but it gives me an erroraddOnSuccessListeneronSuccessgetDownloadUrl()taskSnapshot

Cannot resolve method getDownloadUrl()

I created this app 2 months ago, the app was working fine before and it worked getDownloadUrl()fine. Also, taskSnapshotwhen I press Ctrl+space , for example, I can't find a getDownloadUrl()way in the suggestions. Why is this so?

code to onActivityResult():

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode == RC_SIGN_IN) {
        if (resultCode == RESULT_OK) {
            Toast.makeText(this, "Signed in!!!1", Toast.LENGTH_SHORT).show();
        } else if (resultCode == RESULT_CANCELED) {
            Toast.makeText(this, "Failed to sign in", Toast.LENGTH_SHORT).show();
            finish();
        }
    }
    else if(requestCode == RC_PHOTO_PICKER && resultCode == RESULT_OK){
        Uri selectedPhoto = data.getData();

        StorageReference localRefrence = storageReference.child(selectedPhoto.getLastPathSegment());

        //  Uploading the file on the storage
        localRefrence.putFile(selectedPhoto).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                 Uri downloadUrl = taskSnapshot.getDownloadUrl();

                FriendlyMessage message = new FriendlyMessage(mUsername, null, downloadUrl.toString());
                databaseReference.push().setValue(message);
            }
        });
    }
}
Daniel F

Firebase API has changed .

May 23, 2018

Cloud Storage Version 16.0.1

Removed deprecated StorageMetadata.getDownloadUrl() and UploadTask.TaskSnapshot.getDownloadUrl() methods. To get the current download URL, use StorageReference.getDownloadUr().

UploadTask.TaskSnapshotThere is a method called , which returns an object.getMetadata()StorageMetadata

The object contains a method named , which returns an object.StorageMetadatagetReference()StorageReference

The object contains the method, which now returns a Task object instead of a Uri object.StorageReferencegetDownloadUrl()

This Task must then be listened to to obtain a Uri, which can be done asynchronously or in a blocking fashion; see Tasks API .

Related


Firebase Storage's getDownloadUrl() method cannot be resolved

Neeraj Sewani To upload images to Firebase Storage, attach to a StorageReference instance . When I override the method, the instance I am calling , but it gives me an erroraddOnSuccessListeneronSuccessgetDownloadUrl()taskSnapshot Cannot resolve method getDownl

Firebase Storage's getDownloadUrl() method cannot be resolved

Neeraj Sewani To upload images to Firebase Storage, attach to a StorageReference instance . When I override the method, the instance I am calling , but it gives me an erroraddOnSuccessListeneronSuccessgetDownloadUrl()taskSnapshot Cannot resolve method getDownl

Flutter : getDownloadUrl (firebase storage)

killian I have a problem with my flutter application. I want to upload an image to firebase storage and get the URL but the getDownloadUrl method doesn't work. Here is my code : import 'package:firebase_storage/firebase_storage.dart' as firebase_storage; ...

Flutter : getDownloadUrl (firebase storage)

killian I have a problem with my flutter application. I want to upload an image to firebase storage and get the URL but the getDownloadUrl method doesn't work. Here is my code : import 'package:firebase_storage/firebase_storage.dart' as firebase_storage; ...

Flutter : getDownloadUrl (firebase storage)

killian I have a problem with my flutter application. I want to upload an image to firebase storage and get the URL but the getDownloadUrl method doesn't work. Here is my code : import 'package:firebase_storage/firebase_storage.dart' as firebase_storage; ...

Flutter : getDownloadUrl (firebase storage)

killian I have a problem with my flutter application. I want to upload an image to firebase storage and get the URL but the getDownloadUrl method doesn't work. Here is my code : import 'package:firebase_storage/firebase_storage.dart' as firebase_storage; ...

Firebase getDownloadURL cannot set Img Src from storage

Ethan I am trying to replicate the results of this question here . I can call a getDownloadURL()valid database child, but the result it returns can't seem to be set to IMG's src. This is the code I'm currently using to try and get the download URL: var storage

Token validity for Firebase Storage getDownloadUrl

Bumblebee I have a problem with the "token" in the url(&token=) when using FirebaseStorage's getDownloadUrl. https://firebasestorage.googleapis.com/v0/b/someapplication.appspot.com/o/images%2Fsample.png?alt=media&token=123456 It says to return a "long lived" d

Token validity for Firebase Storage getDownloadUrl

Bumblebee I have a problem with the "token" in the url(&token=) when using FirebaseStorage's getDownloadUrl. https://firebasestorage.googleapis.com/v0/b/someapplication.appspot.com/o/images%2Fsample.png?alt=media&token=123456 It says to return a "long lived" d

Token validity for Firebase Storage getDownloadUrl

Bumblebee I have a problem with the "token" in the url(&token=) when using FirebaseStorage's getDownloadUrl. https://firebasestorage.googleapis.com/v0/b/someapplication.appspot.com/o/images%2Fsample.png?alt=media&token=123456 It says to return a "long lived" d

Firebase Storage "getDownloadURL" returns undefined

Oy3 I am trying to add an image to firebase storage and use the image URL to add data to firestore. The image is uploading to firebase storage, but if I use the getDownloadUrl method, it doesn't return the URL. It returns this error: Uncaught TypeError: Cannot

Token validity for Firebase Storage getDownloadUrl

Bumblebee I have a problem with the "token" in the url(&token=) when using FirebaseStorage's getDownloadUrl. https://firebasestorage.googleapis.com/v0/b/someapplication.appspot.com/o/images%2Fsample.png?alt=media&token=123456 It says to return a "long lived" d

Token validity for Firebase Storage getDownloadUrl

Bumblebee I have a problem with the "token" in the url(&token=) when using FirebaseStorage's getDownloadUrl. https://firebasestorage.googleapis.com/v0/b/someapplication.appspot.com/o/images%2Fsample.png?alt=media&token=123456 It says to return a "long lived" d

How to get URL getDownloadURL from Firebase Storage

Jonathan Fager: I'm trying to get "Long Persistent Download Links" for a file in a Firebase bucket. I have changed its permissions to service firebase.storage { match /b/project-xxx.appspot.com/o { match /{allPaths=**} { allow read, write; }

getDownloadUrl Firebase Storage returns Null (Android)

Franklin David Macias Avilan I'm working on a small project and I have some questions about firebase Storage and getDownloadUrl. I have uploaded some images on FirebaseStorage but when I try to get the download Url it returns null. Here is the code: Import: im

How to get URL getDownloadURL from Firebase Storage

Jonathan Fager I'm trying to get "Long Persistent Download Links" for a file in a Firebase bucket. I have changed its permissions to service firebase.storage { match /b/project-xxx.appspot.com/o { match /{allPaths=**} { allow read, write; } }

How to get URL getDownloadURL from Firebase Storage

Jonathan Fager: I'm trying to get "Long Persistent Download Links" for a file in a Firebase bucket. I have changed its permissions to service firebase.storage { match /b/project-xxx.appspot.com/o { match /{allPaths=**} { allow read, write; }

Firebase getDownloadUrl cannot execute onSuccess or onFailure

tim_d: I am trying to get URLaudio files in Cloud Storage. I can post it to storage, but this function just returns null. When debugging, it skips onSuccessboth and onFailure. I know the filename variable is correct, but also tried hardcoding it without succes

Firebase getDownloadUrl cannot execute onSuccess or onFailure

tim_d: I am trying to get URLaudio files in Cloud Storage. I can post it to storage, but this function just returns null. When debugging, it skips onSuccessboth and onFailure. I know the filename variable is correct, but also tried hardcoding it without succes

Firebase getDownloadUrl cannot execute onSuccess or onFailure

tim_d: I am trying to get URLaudio files in Cloud Storage. I can post it to storage, but this function just returns null. When debugging, it skips onSuccessboth and onFailure. I know the filename variable is correct, but also tried hardcoding it without succes

Firebase getDownloadUrl cannot execute onSuccess or onFailure

tim_d: I am trying to get URLaudio files in Cloud Storage. I can post it to storage, but this function just returns null. When debugging, it skips onSuccessboth and onFailure. I know the filename variable is correct, but also tried hardcoding it without succes

Method showAtLocation cannot be resolved

Daniel Todd: I'm trying to create a popup menu that comes from a button in the bottom right corner of the screen. The problem is that the menu will need to be displayed above the button. I've written some Android code . How can I show the popup directly above

Method showAtLocation cannot be resolved

Daniel Todd: I'm trying to create a popup menu that comes from a button in the bottom right corner of the screen. The problem is that the menu will need to be displayed above the button. I've written some Android code . How can I show the popup directly above