2016-04-26 136 views
0

我連接使用谷歌API客戶像這樣的Drive API:谷歌驅動器與谷歌客戶端API的Android用戶信息

apiClient = new GoogleApiClient.Builder(this) 
       .addApi(Drive.API) 
       .addScope(Drive.SCOPE_FILE) 
       .addConnectionCallbacks(this) 
       .addOnConnectionFailedListener(this) 
       .build(); 

它的偉大工程。

我們的用戶現在想看看使用哪個帳戶(用戶名),是否可以使用此API或添加更多內容,如G +?當然最好不會添加。

回答

0

您可以嘗試使用GoogleApiClient來設置帳戶。

以下是document的示例。

GoogleApiClient client = new GoogleApiClient.Builder(this) 
.addApi(Plus.API) 
.addScope(Plus.SCOPE_PLUS_LOGIN) 
.setAccountName("[email protected]") 
.build(); 
client.connect(); 

關於使用G +的想法,你可以試着檢查一下這個page

也嘗試檢查此SO question欲知更多信息。

+0

我想要獲取選定的帳戶名稱,該名稱是使用Google Api Client的對話框選擇的。 – khusrav