5
與實時數據庫,一個可以這樣做:火力地堡公司的FireStore:如何文檔對象轉換爲一個POJO在Android
MyPojo pojo = dataSnapshot.getValue(MyPojo.Class);
,以此來映射對象,一個人如何與Firestore
做到這一點?
CODE:
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("app/users/" + uid).document("notifications").get().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document != null) {
NotifPojo notifPojo = document....// here
return;
}
} else {
Log.d("FragNotif", "get failed with ", task.getException());
}
});
這結轉文件ID? –