How to solve this taskSnapshot.getDownloadUrl().toString(); in new method of firebase storage | بلاگ

How to solve this taskSnapshot.getDownloadUrl().toString(); in new method of firebase storage

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

As taskSnapshot.getDownloadUrl() is depperacted so I followed the firebase post as to get the URL

final StorageReference ref = storageRef.child("images/mountains.jpg");
uploadTask = ref.putFile(file);

 Task urlTask = uploadTask.continueWithTask(new        Continuation>() {
@Override
public Task then(@NonNull Task task) throws Exception {
    if (!task.isSuccessful()) {
        throw task.getException();
    }

    // Continue with the task to get the download URL
    return ref.getDownloadUrl();
}
   }).addOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
    if (task.isSuccessful()) {
        Uri downloadUri = task.getResult();
    } else {
        // Handle failures
        // ...
    }
}
});

but I want

 String downloadUri = taskSnapshot.getDownloadUrl().toString();

instead of

 Uri downloadUri = task.getResult();

How I can do this???

asked 21 secs ago
user9119525

...
نویسنده : استخدام کار بازدید : 4 تاريخ : يکشنبه 11 شهريور 1397 ساعت: 17:35