android studio firebase can't login and register code example

Example: user login for android studio using firebase

auth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, OnCompleteListener{ task ->
    if(task.isSuccessful){
        Toast.makeText(this, "Successfully Registered", Toast.LENGTH_LONG).show()
        val intent = Intent(this, MainActivity::class.java)
        startActivity(intent)
        finish()
    }else {
        Toast.makeText(this, "Registration Failed", Toast.LENGTH_LONG).show()
    }
})

Tags:

Misc Example