signInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
startActivityForResult(intent, SIGN_IN_CODE);
}
});
每个人登录都一样,但是如何从应用程序更改现有用户的电子邮件?
public class AccountSettings extends Fragment {
View rootView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
rootView = inflater.inflate(R.layout.settings_account, container, false);
Button mButton = (Button) rootView.findViewById(R.id.change);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String mEmail = user.getEmail();
user.updateEmail(mEmail)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d("TAAAAGGGG", "User email address updated.");
}
}
});
}
});
return rootView;
}
}
............................................... ................................................... .............
答案 0 :(得分:0)
您需要重新认证用户。根据文档,更改主电子邮件地址是一项敏感的操作。
要进行重新认证,您可以使用类似这样的代码,{
"manifest_version": 1,
"name": "iPodLinux +",
"version": "1.0",
"description": "Allows all unclickable links to be clicked on.",
"content_scripts": [{
"matches": ["*://*ipodlinux.org*"],
"js": ["ipodlinuxplus.js"]
}]
}
变量在成功登录后具有result
。
GoogleSignInResult