Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private fun addUploadRecordToDb(uri: String){
val db = FirebaseFirestore.getInstance()
val data = HashMap<String, Any>()
data["imageUrl"] = uri
db.collection("posts")
.add(data)
.addOnSuccessListener { documentReference ->
Toast.makeText(this, "Saved to DB", Toast.LENGTH_LONG).show()
}
.addOnFailureListener { e ->
Toast.makeText(this, "Error saving to DB", Toast.LENGTH_LONG).show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.