Android Studio Firebase createUserWithEmailAndPassword OnComplete未触发

时间:2017-01-26 13:35:17

标签: android firebase firebase-authentication

我只是对Android Studio进行简单注册,但由于某种原因,用户已成功创建,但onComplete从未运行。

Log.d(TAG, "Before Testing" );
            mAuth.createUserWithEmailAndPassword(mEmail, mPassword)
                    .addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            Log.d(TAG, "Start Testing"+task.getException() );
                            Toast.makeText(LoginActivity.this, "New Account Is created",
                                    Toast.LENGTH_SHORT).show();
                            // If sign in fails, display a message to the user. If sign in succeeds
                            // the auth state listener will be notified and logic to handle the
                            // signed in user can be handled in the listener.
                            if (!task.isSuccessful()) {
                                Log.d(TAG, "Testing Not Success" + task.getException());
                                task.getException();

                                Log.d(TAG, "Testing Not Success 2" + task.isSuccessful());

                            }else{
                                Log.d(TAG, "Testing is Success" + task.isSuccessful());
                                // startActivity(new Intent(LoginActivity.this, MainMenuActivity.class));
                                // finish();
                            }

                            // ...
                        }
                    });

我想知道如何检查异常,为什么onComplete从未触发过,因为我对编程仍然很陌生。

如果有任何重复的问题,我很抱歉。

0 个答案:

没有答案