I have this method in my main activity where I can only move on after it is confirmed that the user account was successfully created. when I click on confirm I can see that the account is created on firebase but onCompleteListener seems to never be invoked, so my count down latch is never decreased in value.
public boolean signUpUser(User user)
{
FirebaseApp.initializeApp(this);
FirebaseAuth firebaseAuth=FirebaseAuth.getInstance();
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
// success = false;
CountDownLatch countDownLatch = new CountDownLatch(1);
Log.e("Account","Creating user");
firebaseAuth.createUserWithEmailAndPassword(user.getEmail(),user.getPassword()).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(Task<AuthResult> task) {
Log.e("Account","User Created");
if(task.isSuccessful())
{
//createProfile(user,task);
success = true;
}
countDownLatch.countDown();
}
});
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
return success;
}