Uri downloaduri=taskSnapshot.getDownloadUrl();//here i cant use getdownloadurl() function
DatabaseReference new_prod=db.push();
new_prod.child("product name").setValue(prod_name);
new_prod.child("product price").setValue(prod_price);
new_prod.child("available stock").setValue(prod_quan);
new_prod.child("product image").setValue(downloaduri);
pd.dismiss();//fragments code
我无法使用getdownloadurl。我已经将图像存储在Firebase存储器中了,这是限制使用getdownloadurl的片段吗?我的动机是要进行查询以存储在firebase中。请帮助我。
答案 0 :(得分:4)
taskSnapshot.getDownloadUrl()
方法已在Firebase Storage SDK的最新版本中删除。您现在需要从StorageReference
获取下载URL。
来自documentation on downloading a file:
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' in uri System.out.println(uri.toString()); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle any errors } });
或者,在您的情况下,第一行可能是这样:
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
另请参阅:
答案 1 :(得分:1)
经过数小时的研究和不同的方式,这对我有用:
filepath.putFile(resultUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
//here
Task<Uri> urlTask = taskSnapshot.getStorage().getDownloadUrl();
while (!urlTask.isSuccessful());
Uri downloadUrl = urlTask.getResult();
final String sdownload_url = String.valueOf(downloadUrl);
答案 2 :(得分:0)
df.groupby(['x','y']).size()==1
Out[308]:
x y
1 a True
2 b True
3 c True
4 d False
dtype: bool
答案 3 :(得分:0)
下面的方法对我有用。
- hosts: localhost
tasks:
- name: create hosts file from template
template:
src: hosts_file.j2
dest: {{store_files_path}}/{{ansible_date_time.date}}/{{ansible_date_time.time}}/hosts.txt
答案 4 :(得分:0)
这是 Kotlin 解决方案,它在搜索 3 小时后对我有用
val uploadTask =
FirebaseStorage.getInstance().reference.child("images").child(imageName).putBytes(data)
uploadTask.addOnFailureListener {
// Handle unsuccessful uploads
Toast.makeText(baseContext, "Failed to upload", Toast.LENGTH_LONG).show()
}.addOnSuccessListener {
Toast.makeText(
baseContext, "Image uploaded",
Toast.LENGTH_LONG
).show()
var downloadUrl: Uri? = null
FirebaseStorage.getInstance().reference.child("images")
.child(imageName).downloadUrl.addOnSuccessListener { it1 ->
downloadUrl = it1
}
}
downloadUrl 是您的网址