谷歌驱动器与谷歌客户端API的Android用户信息

问题描述:

我连接使用谷歌API客户像这样的Drive API:谷歌驱动器与谷歌客户端API的Android用户信息

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

它的伟大工程。

我们的用户现在想看看使用哪个帐户(用户名),是否可以使用此API或添加更多内容,如G +?当然最好不会添加。

您可以尝试使用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