Answers for "android java add new record to Firebase Firestore"

0

android java add new record to Firebase Firestore

Map<String, Object> city = new HashMap<>();
city.put("name", "Los Angeles");
city.put("state", "CA");
city.put("country", "USA");

db.collection("cities").document("LA")
        .set(city)
        .addOnSuccessListener(new OnSuccessListener<Void>() {
            @Override
            public void onSuccess(Void aVoid) {
                Log.d(TAG, "DocumentSnapshot successfully written!");
            }
        })
        .addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                Log.w(TAG, "Error writing document", e);
            }
        });
Posted by: Guest on May-28-2020

Code answers related to "android java add new record to Firebase Firestore"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language