I am using Firestore for Android. I know it has persistence enabled by default.
Here is some background:
My app shows a list of notes and every note is tied to a label. Therefore while creating a note, I must present a list of labels (in a Dialog
, in response to 'Select label' button), which will be provided to me by a snapshot listener on a Query
. As creating a note is a separate Activity
, each time user goes to create one, the complete list of labels must be presented.
My questions are:
- Is snapshot listener smart enough to fetch the data from cache every other time, except for the first time? (And that "first time" will be after 30 mins when the listener expires, or Firestore clears the cache to save space, right?)
- What is the impact of attaching and detaching listeners frequently? I am attaching the listener in
Activity
'sonStart()
and removing itonStop()
. Here, the user may switch between apps to copy data from some other source to add it in the note, making listener detach/attach. Will this impact my read count? - How
get()
will behave in these scenarios? (I am not a fan of this as it isn't realtime)
Firestore keeps confusing me about the pricing as I dive deep into it. Need a good clarity on the behaviour of components around offline data and its pricing side.