【问题标题】:Google Drive with Google Client Api Android user info带有 Google Client Api Android 用户信息的 Google Drive
【发布时间】:2016-04-26 11:35:24
【问题描述】:

我正在使用 Google Api Client 连接到 Drive Api,如下所示:

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

效果很好。

我们的用户现在想查看正在使用哪个帐户(用户名),是否可以使用此 api 或者我应该添加更多,例如 G+?最好的当然是不添加。

【问题讨论】:

    标签: android google-api google-drive-api


    【解决方案1】:

    您可以尝试使用GoogleApiClient 设置帐户。

    这是来自document 的示例。

    GoogleApiClient client = new GoogleApiClient.Builder(this)
    .addApi(Plus.API)
    .addScope(Plus.SCOPE_PLUS_LOGIN)
    .setAccountName("users.account.name@gmail.com")
    .build();
    client.connect();
    

    关于您使用 G+ 的想法,您可以尝试查看此page

    也请尝试查看此SO question 了解更多信息。

    【讨论】:

    • 我想获取选择的账户名,这是使用 Google Api Client 的对话框选择的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-25
    • 1970-01-01
    • 2013-01-27
    • 1970-01-01
    相关资源
    最近更新 更多