コード例 #1
0
 public void startGoogleLogin(LoginListener googleLoginListener) {
   this.googleLoginListener = googleLoginListener;
   if (googleConnectionResult != null && googleConnectionResult.hasResolution()) {
     try {
       googleConnectionResult.startResolutionForResult(activity, ACTIVITY_GOOGLE_CONNECTION);
     } catch (IntentSender.SendIntentException e) {
       googleConnectionResult = null;
       googleClient.connect();
     }
   } else if (googleClient.isConnected()) {
     googleConnectionResult = null;
     Person user = Plus.PeopleApi.getCurrentPerson(googleClient);
     Log.i("Menyou", "Google logged in: " + user);
     googleLoginListener.onSuccess(user.getId(), user.getName().getFormatted(), null, null);
     this.googleLoginListener = null;
   } else {
     googleConnectionResult = null;
     googleClient.connect();
   }
 }