Answer the question
In order to leave comments, you need to log in
How to fix error with adding information in Firebase Database?
There is the following function:
if (fullname.isNotEmpty() && password.isNotEmpty()) {
val email = mEmail
if (email != null) {
mAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener {
if (it.isSuccessful) {
val user = makeUser(fullname, email)
val reference = mDatabase.child("users").child(it.result!!.user!!.uid)
reference.setValue(user).addOnCompleteListener {
if (it.isSuccessful) {
startHomeActivity()
} else {
Log.e(TAG, "Failed to create user profile", it.exception)
showToast("Something wrong happened. Please try again later")
}
}
} else {
Log.e(TAG, "Failed to create user", it.exception)
showToast("Something wrong happened. Please try again later")
}
}
} else {
Log.e(TAG, "onRegister: email is null")
showToast("Please enter email")
supportFragmentManager.popBackStack()
}
} else {
showToast("Please enter full name and password")
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question