java - 使用 getDownloadUrl() 的 Firebase 存储 "retrieves a long lived download URL"现在已弃用

标签 java android firebase firebase-storage

getDownloadUrl() 方法在更新为

后显示已弃用

'com.google.firebase:firebase-storage:15.0.2'

官方网站上没有任何其他方式来实现 url,那么有什么方法可以以非弃用的方式实现 Url 吗?

/** @deprecated */
@Deprecated
@Nullable
public Uri getDownloadUrl() {
    StorageMetadata var1;
    return (var1 = this.getMetadata()) != null ? var1.getDownloadUrl() : null;
    }
}

最佳答案

在文档中是这样说的:

The getDownloadUrl() and getDownloadUrls() methods of the StorageMetadata class are now deprecated. Use getDownloadUrl() from StorageReference instead.

所以你需要使用getDownloadUrl()StorageReference 里面

public Task<Uri> getDownloadUrl ()

Asynchronously retrieves a long lived download URL with a revokable token. This can be used to share the file with others, but can be revoked by a developer in the Firebase Console if desired.

更多信息在这里:

https://firebase.google.com/docs/reference/android/com/google/firebase/storage/StorageReference#getDownloadUrl()

关于java - 使用 getDownloadUrl() 的 Firebase 存储 "retrieves a long lived download URL"现在已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50158921/

相关文章:

java - 将实例变量公开给其他类的正确方法

android - 为 Android Studio 项目中的不同模块依赖项添加单独的 jniLibs 引用

java - 如何自动刷新Listview?

java - Android AdMob - NoSuchMethodError : No static method zzand()

java - 有没有办法让我的应用程序等待从 Firebase 检索数据,然后再继续代码?

javascript - 如何通过输入元素(原始js)实时检查JavaScript对象中是否存在用户

java - Selenium WebDriver 中的 "Element not found in the cache"

java - 在彼此之间类型转换子实体

java - 将 Double 转换为 java.sql.Time

android - Android 上的可变视频播放速率