【发布时间】:2018-03-19 03:48:09
【问题描述】:
我收到此运行时错误,我不明白其背后的原因。
com.google.firebase.firestore.FirebaseFirestoreException: Failed to get document because the client is offline.
下面是我的 Activity 中尝试从云 Firestore 获取数据的代码
DocumentReference docRef = db.collection("room-id-1").document("participan-name-1");
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document != null) {
Log.d(TAG, "DocumentSnapshot data: " + task.getResult().getData());
userData.registerUserToHotspot(roomId_str, participantName_str);
} else {
Log.d(TAG, "No such document");
}
} else {
Log.d(TAG, "get failed with ", task.getException());
}
}
});
对此我能做些什么吗?
【问题讨论】:
-
我遇到了同样的问题。 FirebaseFirestoreException.Code 为“不可用”。这意味着“服务当前不可用。这很可能是暂时的情况,可以通过回退重试来纠正。”我不知道我现在该怎么办......
-
同样的问题,有解决办法吗?
-
我看到这个错误是因为你没有连接或客户端不可用,perharps,我遇到了问题,因为即使我在,以与您相同的方式管理异常。更有趣的是,在恢复我的互联网后,第一个查询总是会发生错误。示例:
Flight mode > Do nothing > off Flight mode > wait 20s > query something > Failed to get document because the client is offline.这是来自 API 的错误?这只是在 Android 中发生,而不是在 IOS 中发生 -
这方面的任何进展,这绝对是一个交易破坏者。无法在 Android 上使用 Firestore?
-
嗨!有这方面的消息吗?我今天在 firebase-firestore:17.1.1 上仍然面临完全相同的问题。
标签: android firebase google-cloud-firestore