Skip to content

Instantly share code, notes, and snippets.

@NezSpencer
Created July 22, 2018 18:23
Show Gist options
  • Save NezSpencer/1fc334fa3ca3a48826d699949e20a9fa to your computer and use it in GitHub Desktop.
Save NezSpencer/1fc334fa3ca3a48826d699949e20a9fa to your computer and use it in GitHub Desktop.
How to set a single value to firebase realtime database and firestore
//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