Created
July 22, 2018 18:23
-
-
Save NezSpencer/1fc334fa3ca3a48826d699949e20a9fa to your computer and use it in GitHub Desktop.
How to set a single value to firebase realtime database and firestore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//firebase realtime database (RTDB) | |
FirebaseDatabase.getInstance().reference.child("phoneNumber").setValue("+2345899xxx") | |
//Firestore | |
val map = mutableMapOf<String, Any>() | |
map["PhoneNumber1"] = "+2345899xxx" | |
FirebaseFirestore.getInstance().collection("Numbers").document("PhoneNumbers").set(map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment