How to use getdownloadurl in recent versions?
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
I was unable to use getdownloadurl .I have already stored image in the firebase storage.Is it the fragment that is restricting the use of getdownloadurl? My motive is to make a query to store in firebase.please help me.
android firebase firebase-realtime-database firebase-storage
add a comment |
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
I was unable to use getdownloadurl .I have already stored image in the firebase storage.Is it the fragment that is restricting the use of getdownloadurl? My motive is to make a query to store in firebase.please help me.
android firebase firebase-realtime-database firebase-storage
add a comment |
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
I was unable to use getdownloadurl .I have already stored image in the firebase storage.Is it the fragment that is restricting the use of getdownloadurl? My motive is to make a query to store in firebase.please help me.
android firebase firebase-realtime-database firebase-storage
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
I was unable to use getdownloadurl .I have already stored image in the firebase storage.Is it the fragment that is restricting the use of getdownloadurl? My motive is to make a query to store in firebase.please help me.
android firebase firebase-realtime-database firebase-storage
android firebase firebase-realtime-database firebase-storage
edited Jun 28 '18 at 8:46
saikumar kolisetty
asked Jun 27 '18 at 6:58
saikumar kolisettysaikumar kolisetty
196
196
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The taskSnapshot.getDownloadUrl()
method was removed in recent versions of the Firebase Storage SDK. You will need to instead get the download URL from the StorageReference
now.
From the 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
}
});
Alternatively that first line could be this in your case:
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
Also see:
- Firebase Storage getDownloadUrl() method can't be resolved
- Error: cannot find symbol method getDownloadUrl() of type com.google.firebase.storage.UploadTask.TaskSnapshot
- The example in the Firebase documentation on uploading a file and getting its download URL
add a comment |
This worked for me after hours of research and differents ways :
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);
It works for me
– tushar
Oct 27 '18 at 11:10
add a comment |
storageReference.child("YOUR_CHILD")
.putFile("FILE")
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
taskSnapshot
.getStorage()
.getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(Uri uri) {
//Put your result here
}
});
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51056397%2fhow-to-use-getdownloadurl-in-recent-versions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The taskSnapshot.getDownloadUrl()
method was removed in recent versions of the Firebase Storage SDK. You will need to instead get the download URL from the StorageReference
now.
From the 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
}
});
Alternatively that first line could be this in your case:
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
Also see:
- Firebase Storage getDownloadUrl() method can't be resolved
- Error: cannot find symbol method getDownloadUrl() of type com.google.firebase.storage.UploadTask.TaskSnapshot
- The example in the Firebase documentation on uploading a file and getting its download URL
add a comment |
The taskSnapshot.getDownloadUrl()
method was removed in recent versions of the Firebase Storage SDK. You will need to instead get the download URL from the StorageReference
now.
From the 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
}
});
Alternatively that first line could be this in your case:
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
Also see:
- Firebase Storage getDownloadUrl() method can't be resolved
- Error: cannot find symbol method getDownloadUrl() of type com.google.firebase.storage.UploadTask.TaskSnapshot
- The example in the Firebase documentation on uploading a file and getting its download URL
add a comment |
The taskSnapshot.getDownloadUrl()
method was removed in recent versions of the Firebase Storage SDK. You will need to instead get the download URL from the StorageReference
now.
From the 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
}
});
Alternatively that first line could be this in your case:
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
Also see:
- Firebase Storage getDownloadUrl() method can't be resolved
- Error: cannot find symbol method getDownloadUrl() of type com.google.firebase.storage.UploadTask.TaskSnapshot
- The example in the Firebase documentation on uploading a file and getting its download URL
The taskSnapshot.getDownloadUrl()
method was removed in recent versions of the Firebase Storage SDK. You will need to instead get the download URL from the StorageReference
now.
From the 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
}
});
Alternatively that first line could be this in your case:
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
Also see:
- Firebase Storage getDownloadUrl() method can't be resolved
- Error: cannot find symbol method getDownloadUrl() of type com.google.firebase.storage.UploadTask.TaskSnapshot
- The example in the Firebase documentation on uploading a file and getting its download URL
edited Nov 15 '18 at 14:08
answered Jun 27 '18 at 13:56
Frank van PuffelenFrank van Puffelen
232k29380406
232k29380406
add a comment |
add a comment |
This worked for me after hours of research and differents ways :
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);
It works for me
– tushar
Oct 27 '18 at 11:10
add a comment |
This worked for me after hours of research and differents ways :
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);
It works for me
– tushar
Oct 27 '18 at 11:10
add a comment |
This worked for me after hours of research and differents ways :
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);
This worked for me after hours of research and differents ways :
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);
edited Jul 28 '18 at 5:52
Firanolfind
873824
873824
answered Jul 28 '18 at 0:05
Yous SelfYous Self
114
114
It works for me
– tushar
Oct 27 '18 at 11:10
add a comment |
It works for me
– tushar
Oct 27 '18 at 11:10
It works for me
– tushar
Oct 27 '18 at 11:10
It works for me
– tushar
Oct 27 '18 at 11:10
add a comment |
storageReference.child("YOUR_CHILD")
.putFile("FILE")
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
taskSnapshot
.getStorage()
.getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(Uri uri) {
//Put your result here
}
});
}
add a comment |
storageReference.child("YOUR_CHILD")
.putFile("FILE")
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
taskSnapshot
.getStorage()
.getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(Uri uri) {
//Put your result here
}
});
}
add a comment |
storageReference.child("YOUR_CHILD")
.putFile("FILE")
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
taskSnapshot
.getStorage()
.getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(Uri uri) {
//Put your result here
}
});
}
storageReference.child("YOUR_CHILD")
.putFile("FILE")
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
taskSnapshot
.getStorage()
.getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(Uri uri) {
//Put your result here
}
});
}
answered Jul 24 '18 at 2:14
JPDroidJPDroid
161
161
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51056397%2fhow-to-use-getdownloadurl-in-recent-versions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown