简体   繁体   English

我的注册未发送到Firebase

[英]My registracion is not sending to firebase

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 我正在为我的android应用创建注册,并且无法将数据电子邮件和密码注册发送到火力基地电子邮件/密码已启用

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. 我已经尝试更改Firebase版本,但是从未发生注册,我真的希望我可以解决这个问题。 Thank you very much in advice 非常感谢您的建议

have you enable the Sign-in Method tab by by email/password in your authentication firebase ? 您是否已通过身份验证Firebase中的电子邮件/密码启用“登录方法”选项卡? if not, you can't register to the firebase and data will not show in firebase database. 否则,您将无法注册到Firebase,并且数据将不会显示在Firebase数据库中。 if not the problem of authentication, could you please tell us what the messages in your mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener 如果不是身份验证问题,能否请您告诉我们您的mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener的消息是什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM