Android版Firebase无效电子邮件错误

时间:2016-04-15 20:17:17

标签: java android firebase firebase-authentication

尝试在我的Android应用中将用户注册到firebase时,我总是收到错误消息。

  

"指定的电子邮件无效"

我注意到这种情况发生在JellyBean设备上,我不知道问题是什么,无论是来自API还是其他。

我的代码段如下:

private void registerUser() {
        // Sign Up
            mRef.createUser(mAccount.name, mPassword, new Firebase.ResultHandler() {
                @Override
                public void onSuccess() {
                    loginUser(true);
                }

            @Override
            public void onError(FirebaseError firebaseError) {
                // Sign Up failed
                if (firebaseError.getCode() == FirebaseError.NETWORK_ERROR) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                    builder.setMessage(R.string.connection_error_message)
                            .setTitle(R.string.error_title)
                            .setPositiveButton("Try again", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    checkUserExistence();
                                }
                            }).setCancelable(false);
                    AlertDialog dialog = builder.create();
                    dialog.show();
                } else {
                    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                    builder.setMessage(firebaseError.getMessage())
                            .setTitle(R.string.error_title)
                            .setPositiveButton("Try again", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    registerUser();
                                }
                            }).setCancelable(false);
                    AlertDialog dialog = builder.create();
                    dialog.show();
                }
            }
        });
}

0 个答案:

没有答案