我在我的android应用程序中使用firestore。 在下面的代码中,我能期望异常为非空吗? FirebaseFirestore.getInstance().collection("items").document("abc").get().addOnCompleteListener(task -> {
if (!task.isSuccessful()) {
Exception e = task.getException();
//Can I expect e to be non null, or do I h
我试图读取FireStore数据库中的所有数据,如果任何文档名称匹配,则布尔变量应该是false,否则应该是true。但是布尔变量的值没有变化。
public boolean checkUsername(EditText editText){
final boolean[] flag = {false};
FirebaseFirestore db = FirebaseFirestore.getInstance();
DocumentReference docRef = db.collection("Users").document(editText.ge
我有一个关于URI文件的数组,并使用for循环将它们上传到firebase存储上。根据文档,我可以获得在UploadTask对象上实现continueWithTask和addOnCompleteListener方法的下载url,因此我尝试将所有url保存在一个数组中。我的问题是,我用来保存url的数组是空的,但图像在代码计算后被上传到firestore Storage文件夹中,这可能是因为continueWithTask和addOnCompleteListener是异步方法。
我该怎么解决它呢?
for (int i = 0; i < photos.size(); i++) {
我得到了这个运行时错误,我不理解它背后的原因。
com.google.firebase.firestore.FirebaseFirestoreException: Failed to get document because the client is offline.
下面是我尝试从云Firestore获取数据的活动中的代码
DocumentReference docRef = db.collection("room-id-1").document("participan-name-1");
docRef.get().addOnCompleteList
我对Android的背景任务很陌生。我使用Firestore来执行以下任务:
读一份文件。
DBInstance.collection(“餐馆”) .get() .addOnCompleteListener(任务-> { if (task.isSuccessful(){ for (QueryDocumentSnapshot文档:Objects.requireNonNull(task.getResult(){ //其他代码}{Log.d(标签,“获取文档错误:",task.getException();});
收听另一个文档的实时更新。
final Document
我创建了两个方法来从firestore获取数据。第一种方法是遍历用户选择的属性列表。另一种方法是根据用户的选择查询数据。在迭代每一项之后,新方法需要启动。问题是,即使有可用的数据,我的列表也总是空的。下面是两种方法: private void getStores(ArrayList<String> checkedItems) {
newSeller = new ArrayList<>();
sellers = new ArrayList<>();
a = 0;
for (int i =0; i<checkedIte
我在尝试从firebase存储中检索图像时遇到此错误。
java.lang.IllegalStateException: Task is not yet complete on upload task.
代码:-
Uri imageUri = data.getData();
final StorageReference filePath = UserProfileImageRef.child(currentUserID + ".jpg");
filePath.putFile(imageUri)
.addOnCompleteListener(new OnComplete