I'm getting the following error when trying to get the public downloadUrl from FirebaseStorage. I've set my rules to allow full read and write access, and have no problem storing my data in the storage. However, when I try to get the download url, I get this problem. -
E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.android.gms.internal.zzbtk: Please sign in before trying to get a token.
I've read Firebase getDownloadURL but was still unable to resolve my issue.
Here's my function-
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == 0 && resultCode == RESULT_OK) {
Uri uri = data.getData();
final StorageReference filePath = mStorage.child("Photos").child(uri.getLastPathSegment());
filePath.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// @SuppressWarnings("VisibleForTests") Uri downloadUri = taskSnapshot.getDownloadUrl();
// recognizeImage(downloadUri);
filePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
recognizeImage(uri);
}
});
}
});
}
}