小编BMK*_*BMK的帖子

Google Drive Auth始终返回0

我正在使用此https://developers.google.com/drive/android/auth#connecting_and_authorizing_the_google_drive_android_api中显示的代码

在我的应用程序中,我单击以连接到驱动器,但它导致此行正在执行

 connectionResult.startResolutionForResult(this, 1);
Run Code Online (Sandbox Code Playgroud)

由于连接失败.

然后它会打开一个帐户菜单供我选择帐户.当我点击它然后对话框解除,我仍然无法连接到谷歌驱动器,因为每次结果代码为0

protected void onActivityResult(final int requestCode, final int resultCode,      final Intent data) {
    switch (requestCode) {
        case 1:
            if (resultCode == RESULT_OK) {
                mGoogleApiClient.connect();
           }
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

我会假设代码是正确的,但有人知道我需要做什么来防止取消?我相信我为OA Auth正确设置了我的凭据

google-drive-api google-play-services google-drive-android-api

5
推荐指数
1
解决办法
440
查看次数