【发布时间】:2021-01-15 08:00:37
【问题描述】:
【问题讨论】:
标签: java android firebase firebase-realtime-database mobile
【问题讨论】:
标签: java android firebase firebase-realtime-database mobile
点击此链接-https://firebase.google.com/docs/storage/android/download-files#download_data_via_url
storageRef.child("users/me/profile.png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
// Got the download URL for 'users/me/profile.png'
Uri downloadUri = taskSnapshot.getMetadata().getDownloadUrl();
generatedFilePath = downloadUri.toString(); /// The string(file link) that you need
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});
【讨论】:
Error: cannot resolve method getDownloadUrl() in StorageMetadata。请帮帮我。
taskSnapshot.getMetadata().getStorage().getDownloadUrl(); 或通过此查看taskSnapshot.getStorage().getDownloadUrl();
Task<Uri>而不是Uri,但是如果我将类型设置为Task<Uri>,错误就消失了。还有变量generatedFilePath是什么类型的??