I have two Activities, I am adding data to Firestore from these two activities individually. But, whenever I add second activity data to Firestore, it is overwriting the fir
As per the documentation, you could use as a second parameter {merge:true}
, in my experience the problem usually is in the fact that you are trying to store different data but with the same key.
Even using {merge: true}
will always update the current key with the value you are passing in.
Merge:true Works only if the key does not exist already. I believe every key in a document must be unique.
To test it try to pass(keeping {merge: true}
as the second parameter) data with a different key, it will merge to existing.