Skip to content

How to get real-time updates with Firebase Firestore using @capacitor-firebase/firestore? #758

Closed Answered by robingenz
anthonyjuarezsolis asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for your request. You just need to add a snapshot listener using one of the following methods:

Here is an example from the Usage section:

const addDocumentSnapshotListener = async () => {
  const callbackId = await FirebaseFirestore.addDocumentSnapshotListener(
    {
      reference: 'users/Aorq09lkt1ynbR7xhTUx',
    },
    (event, error) => {
      if (error) {
        console.error(error);
      } else {
        console.log(event);
      }
    }
  );
  return callbackId;
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by robingenz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants