I have this code
val collectionDb = db.collection(collection)
.add(user4)
.addOnSuccessListener { documentReference ->
Log.d("SUCCESS", "DocumentSnapshot added with ID: ${documentReference.id}")
println(documentReference.id)
}
.addOnFailureListener { e ->
Log.w("FAIL", "Error adding document", e)
}
//here wait
println("more code")
}
The output is first more code
and later the DocumentReference.id
But I want that on //here wait
the script pause until there is a success or a fail.
I'm new so it would be very nice when you can help me out.