private void handleSignInResult(GoogleSignInResult result){ Log.i("robin", "handleSignInResult:" + result.isSuccess()); if(result.isSuccess()){ Log.i("robin", "成功"); GoogleSignInAccount acct = result.getSignInAccount(); if(acct!=null){ Log.i("robin", "用户名是:" + acct.getDisplayName()); Log.i("robin", "用户email是:" + acct.getEmail()); Log.i("robin", "用户头像是:" + acct.getPhotoUrl()); Log.i("robin", "用户Id是:" + acct.getId());//之后就可以更新UI了 Log.i("robin", "用户IdToken是:" + acct.getIdToken()); tvMsg.setText("用户名是:" + acct.getDisplayName()+"\n用户email是:" + acct.getEmail()+"\n用户头像是:" + acct.getPhotoUrl()+ "\n用户Id是:" + acct.getId()+"\n用户IdToken是:" + acct.getIdToken()); } }else{ tvMsg.setText("登录失败"); Log.i("robin", "没有成功"+result.getStatus()); } }
public void signup(int mifosSavingsProductId) { showProgressDialog(Constants.PLEASE_WAIT); Intent intent = new Intent(LoginActivity.this, MobileVerificationActivity.class); intent.putExtra(Constants.MIFOS_SAVINGS_PRODUCT_ID, mMifosSavingProductId); if (account != null) { intent.putExtra(Constants.GOOGLE_PHOTO_URI, account.getPhotoUrl()); intent.putExtra(Constants.GOOGLE_DISPLAY_NAME, account.getDisplayName()); intent.putExtra(Constants.GOOGLE_EMAIL, account.getEmail()); intent.putExtra(Constants.GOOGLE_FAMILY_NAME, account.getFamilyName()); intent.putExtra(Constants.GOOGLE_GIVEN_NAME, account.getGivenName()); } hideProgressDialog(); startActivity(intent); if (googleSignInClient != null) { googleSignInClient.signOut().addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { account = null; } }); } } }
private void handleSignInResult(GoogleSignInResult result) { if (result.isSuccess()) { Log.d("G + login success"); GoogleSignInAccount acct = result.getSignInAccount(); SocialProfile socialProfile = new SocialProfile(PROVIDER_GOOGLE, acct.getId(), acct.getPhotoUrl()==null?null:acct.getPhotoUrl().toString()); user = new User(acct.getEmail(), acct.getDisplayName(), socialProfile); loggedInMode = USER_LOGIN_GOOGLE; loginUser(user.getProvider() != null); } else { // Signed out, show unauthenticated UI. Log.d("G + logout"); } }
private GoogleAuthUser parseToGoogleUser(GoogleSignInAccount account) { GoogleAuthUser user = new GoogleAuthUser(); user.name = account.getDisplayName(); user.familyName = account.getFamilyName(); user.idToken = account.getIdToken(); user.email = account.getEmail(); user.photoUrl = account.getPhotoUrl(); return user; }
String personEmail = acct.getEmail(); String personId = acct.getId(); Uri personPhoto = acct.getPhotoUrl();