DRIVE ANDROID API是否无法下载非我的应用程序创建的公共文件?

时间:2016-05-21 03:13:55

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

我正在尝试从我的Google驱动器中捕获某些公共文件的下载链接,但方法metadataBuffer.getCount()始终返回0。 我在其他帖子中看到问题是范围

GoogleApiClient.Builder builder = new GoogleApiClient.Builder(context);
        builder.addApi(Drive.API);
        builder.addScope(Drive.SCOPE_FILE);
        builder.setAccountName(EXTRA_ACCOUNT_NAME);
        builder.addConnectionCallbacks(connectionCallbacks);
        builder.addOnConnectionFailedListener(connectionFailedListener);

        googleApiClient = builder.build();
        googleApiClient.connect(); // always connection success


但是只有两个选项“范围”显然是Drive.SCOPE_FILEDrive.SCOPE_FOLDER

private ResultCallback<DriveApi.MetadataBufferResult> metadataBufferCallback = new ResultCallback<DriveApi.MetadataBufferResult>() {
    @Override
    public void onResult(@NonNull DriveApi.MetadataBufferResult metadataBufferResult) {
        MetadataBuffer metadataBuffer = metadataBufferResult.getMetadataBuffer();

        int count = metadataBuffer.getCount(); // <--- always return 0
        Log.d(TAG, "count " + count);
    }
};

如何使用Drive API v3查看公用文件夹中的所有文件?

0 个答案:

没有答案