I am creating a registation for my android app and i cant send the data email and password registation to fire base Email/passwor is enable
public class RegistoScreen extends AppCompatActivity implements View.OnClickListener{
ProgressBar progressBar;
EditText editTextEmail,editTextPassword;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registo_screen);
editTextEmail = findViewById(R.id.mail_editor);
editTextPassword = findViewById(R.id.pass_editor);
progressBar=(ProgressBar) findViewById(R.id.progressbar);
mAuth = FirebaseAuth.getInstance();
findViewById(R.id.butom_registo_reg).setOnClickListener(this);
}
private void registerUser(){
String email=editTextEmail.getText().toString().trim();
String password=editTextPassword.getText().toString().trim();
if(email.isEmpty()){
editTextEmail.setError("Email está vazio");
editTextEmail.requestFocus();
return;
}
if(password.isEmpty()){
editTextPassword.setError("Password em falta");
editTextPassword.requestFocus();
}
if(!Patterns.EMAIL_ADDRESS.matcher(email).matches()){
editTextEmail.setError("O email inserido não e valido");
editTextEmail.requestFocus();
return;
}
if(password.length()<6){
editTextPassword.setError("O tamanho minimo da password é 6 caracters");
editTextPassword.requestFocus();
return;
}
progressBar.setVisibility(View.GONE);
mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(getApplicationContext(),"Utilizador Criado com sucesso",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(getApplicationContext(),"Algo erro na criacao da conta",Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.butom_registo_reg:
registerUser();
break;
case R.id.butom_voltar:
startActivity(new Intent(this,LoginScreen.class));
break;
this is the dependencis
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
i already try to change the firebase version but the registatcion never happends i realy hope that i can fi this. Thank you very much in advice
have you enable the Sign-in Method tab by by email/password in your authentication firebase ? if not, you can't register to the firebase and data will not show in firebase database. if not the problem of authentication, could you please tell us what the messages in your mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.