listChildren在rootFolder上返回零计数 - googledrive apiMet [英] listChildren returning zero count on rootFolder - googledrive apiMet

查看:186
本文介绍了listChildren在rootFolder上返回零计数 - googledrive apiMet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  DriveFolder mFolder = Drive.DriveApi.getRootFolder(Drive.DriveApi.getRootFolder(移动客户端); 
mFolder.listChildren(mClient).setResultCallback(mChilds);

,回调是 -

MetadataBuffer mBuffer = arg0.getMetadataBuffer();
StringBuilder mBuilder = new StringBuilder();
int count = mBuffer.getCount();
迭代器<元数据> itr = mBuffer.iterator();
while(itr.hasNext()){
Metadata mData = itr.next();
mBuilder.append(mData.getTitle()+\\\
);
}
TextView tView =(TextView)findViewById(R.id.txt);
tView.setText(mBuilder.toString());
}

我在这里做错了什么?
在此先感谢。

解决方案

问题在于范围。 Google play服务库仅支持Scope
FILE_SCOPE

APP_FOLDER_SCOPE
都可以获取使用该应用程序创建的文件。
服务库不支持全驱动器访问。出于这个原因,listChildren返回了0个元素(这意味着没有该应用程序创建的文件)。


I am getting zero child from the root folder while accessing my drive.

DriveFolder mFolder = Drive.DriveApi.getRootFolder(mClient);
mFolder.listChildren(mClient).setResultCallback(mChilds);

and the callback is -

public void onResult(MetadataBufferResult arg0) {
    MetadataBuffer mBuffer = arg0.getMetadataBuffer();
    StringBuilder mBuilder = new StringBuilder();
    int count = mBuffer.getCount();
    Iterator<Metadata> itr = mBuffer.iterator();
    while (itr.hasNext()) {
        Metadata mData = itr.next();
        mBuilder.append(mData.getTitle() + "\n");
    }
    TextView tView = (TextView) findViewById(R.id.txt);
    tView.setText(mBuilder.toString());
}

What am I doing wrong here?? Thanks in advance.

解决方案

The problem was with scope. Google play service library only supports Scope FILE_SCOPE and APP_FOLDER_SCOPE both can get file which is created with the application. The service library doesnot support full drive access. For this reason listChildren was returning 0 elements (meaning there was no file which was created by this application).

这篇关于listChildren在rootFolder上返回零计数 - googledrive apiMet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆