I am trying to get download url from firebase but it gives me some another link like “com.google.android.gms.tasks.zzu@b9761c8” [duplicate]

∥☆過路亽.° 提交于 2020-01-30 11:10:46

问题


I am trying to get download url from firebase but it gives me some another link like "com.google.android.gms.tasks.zzu@b9761c8"


回答1:


You need to add listeners when retrieving the url.

Please read the documentations

taskSnapshot.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
    @Override
    public void onSuccess(Uri uri) {
        // Got the uri
        ImageUpload imageUpload = new ImageUpload(editText5.getText().toString(), uri.toString());
        // Wrap with Uri.parse() when retrieving

        String uploadId = mDatabaseRef.push().getKey();
        mDatabaseRef.child(uploadId).setValue(imageUpload);
    }
}).addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception exception) {
        // Handle any errors
    }
});


来源:https://stackoverflow.com/questions/52287588/i-am-trying-to-get-download-url-from-firebase-but-it-gives-me-some-another-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!