2014-10-28 20 views

回答

0

確保您正在構建您的GoogleApiClient。您需要Google Plus登錄和個人資料信息的範圍。你還需要添加Plus API。請注意,以下示例假定此代碼所在的類還實現了適當的連接偵聽器。

// somewhere in onCreate 
mGoogleApiClient = new GoogleApiClient.Builder(this) 
             .addConnectionCallbacks(this) 
             .addOnConnectionFAiledListener(this) 
             .addScope(Plus.SCOPE_PLUS_LOGIN) 
             .addScope(Plus.SCOPE_PLUS_PROFILE) 
             .addApi(Plus.API) 
             .build(); 

// other code.... 
@Override 
public void onConnected(Bundle connectionHint) { 
    // Get the profile image here 
} 
相關問題