When I try and sign-up in my app, the progress bar just runs endlessly because my app isn't able access the database. I've tried a few solutions on getting an updated googles-services.json
file and changing the URL in my code but nothing seems to work.
The error that comes up:
W/PersistentConnection: pc_0 - Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Database lives in a different region. Please change your database URL
progressBar.setVisibility(View.VISIBLE);
mAuth.createUserWithEmailAndPassword(email,mobile)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
RegData user = new RegData(name, email, mobile);
FirebaseDatabase.getInstance("https://bioapps-customer-services-default-rtdb.asia-southeast1.firebasedatabase.app/");
FirebaseDatabase.getInstance().getReference().child("RegData")
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
Toast.makeText(SignUpActivity.this, "Registration Successful",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
}else{
Toast.makeText(SignUpActivity.this, "Registration Failed, Please Try Again",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
}
}
});
}else{
Toast.makeText(SignUpActivity.this, "Registration Failed, Please Try Again",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
}
}
});
}
}