skip to Main Content

Does firebase store duplicate copy DeviceID that was generated by the app in google cloud server?

App device InstancesIDs are stored in my Database sent by my app. If firebase stores copy of instanceID how would I get it via API.

2

Answers


  1. As per the documentation on simple and compound queries.

    import { collection, query, where, getDocs, limit } from "firebase/firestore";
    
    // define query parameters and limit to 1 document (duplicate ID check)
    const instanceIDQuery = query(
      collection(db, "collection name here"),
      where("instanceID", "==", "your instance ID here"),
      limit(1)
    );
    
    const querySnapshot = await getDocs(instanceIDQuery);
    querySnapshot.forEach((doc) => {
      // doc.data() is never undefined for query doc snapshots
      console.log(doc.id, " => ", doc.data());
    });
    

    Make sure you call getDocs asynchronously.

    Login or Signup to reply.
  2. Based on my understanding, you want to get all the tokens generated by your app from server-side. Currently, there’s no API that can retrieve all registration tokens. You should send and store the tokens to your server upon generation (which you’re doing already).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search