So half of my application relies quite a bit on Firestore.
Sometimes, it takes quite a long time, like 5000ms
or more to load my documents. If it was images or something else maybe I'd understand but it's mainly strings or Ints...
Any ideas on how I could improve this?
Thanks
EDIT: db.collection("usersAuth/${FirebaseAuth.getInstance().uid!!}/KitLists").get().addOnSuccessListener { snapshot ->
for (document in snapshot.documents) {
val data = document
val kitName = data.id
firstKitList.add(kitName)
}
mainListViewAdapter.notifyDataSetChanged()
}
EDIT2
So, I adapted it, but I have an unresolved error on snapshot
.
db.collection("usersAuth/${FirebaseAuth.getInstance().uid!!}/KitLists").addSnapshotListener(object : EventListener<QuerySnapshot> {
override fun onEvent(@Nullable value: QuerySnapshot, @Nullable e: FirebaseFirestoreException?) {
if (e != null) {
Log.w("TAG", "Listen failed.", e)
return
}
for (document in snapshot.documents) {
val data = document
val kitName = data.id
firstKitList.add(kitName)
}
mainListViewAdapter.notifyDataSetChanged()
}
})
this is the error