【发布时间】:2018-03-29 04:19:47
【问题描述】:
所以我正在开发一个使用 firebase 的 firestore 的应用程序,我想知道这是否可行,因为我不希望我的应用程序检查服务器中不再存在的数据。
示例:
collectionReference.addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(QuerySnapshot snapshots, FirebaseFirestoreException e) {
for (DocumentSnapshot snapshot : snapshots) {
System.out.println(snapshot.getId());
// This prints document IDs of documents that were deleted
// from the collection when the app was not running
}
}
});
使用DocumentSnapshot.exists() 过滤仅存在于服务器中的快照不起作用
更多信息this page:
初始状态可以直接来自服务器,也可以来自本地缓存。如果本地缓存中有可用的状态,查询快照将首先填充缓存数据,然后在客户端赶上服务器状态时使用服务器数据进行更新。
【问题讨论】:
标签: java android firebase google-cloud-firestore