Advertisements

FS DB writing to collection

        //Getting instance
        FirebaseFirestore db = FirebaseFirestore.getInstance();

        //Creating Map for the values we want to store
        Map<String, String> data = new HashMap<>();
        data.put("username", "waqas");

        //Getting Reference to "users" collection and adding the data
        db.collection("users").add(data);