Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDownloadUrl Error #52

Open
kuwarsingh opened this issue Oct 31, 2018 · 2 comments
Open

getDownloadUrl Error #52

kuwarsingh opened this issue Oct 31, 2018 · 2 comments

Comments

@kuwarsingh
Copy link

StorageReference filepath=mStorage.child("T_image").child(mImageUri.getLastPathSegment());
filepath.putFile(mImageUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@OverRide
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(upload_teach_info.this, "success", Toast.LENGTH_SHORT).show();
DatabaseReference new_add=mDatabase.push();
new_add.child("Name").setValue(mName);
new_add.child("Email").setValue(mEmail);
new_add.child("Desciption").setValue(mDesc);
new_add.child("Image").setValue(downloadUri.toString());
}
})
.addOnFailureListener(new OnFailureListener() {
@OverRide
public void onFailure(@nonnull Exception e) {
Toast.makeText(upload_teach_info.this, "failed!", Toast.LENGTH_SHORT).show();
}
});

    }
}
@kuwarsingh
Copy link
Author

public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

                Task<Uri> dowmloadUrl =taskSnapshot.getStorage().getDownloadUrl();
                DatabaseReference new_add=mDatabase.push();
                new_add.child("Name").setValue(mName);
                new_add.child("Email").setValue(mEmail);
                new_add.child("Desciption").setValue(mDesc);
               new_add.child("Image").setValue(dowmloadUrl.toString());
            }
        })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Toast.makeText(upload_teach_info.this, "failed!", Toast.LENGTH_SHORT).show();
                    }
                });

solved

@kuwarsingh
Copy link
Author

kuwarsingh commented Nov 20, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant