尝试在我的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();
}
}
});
}