Google Drive Android API可以用于列出Google Drive上的所有文件吗?

Google Drive Android API可以用于列出Google Drive上的所有文件吗?,android,google-drive-android-api,Android,Google Drive Android Api,我想列出用户谷歌硬盘上的所有文件(不仅仅是应用程序创建的所有文件),然后下载所选文件。我发现android有两个API Google Drive API和Google Drive REST API。在搜索了很多之后,我知道我可以使用RESTAPI获得文件列表,但不确定Android API。请指导我如何继续。也可用于Android。你可以在这张照片上看到 /** *获取最多10个文件名和ID的列表。 *@返回描述文件的字符串列表,如果没有文件,则返回空列表 *找到了。 *@抛出异常 */ 私有列

我想列出用户谷歌硬盘上的所有文件(不仅仅是应用程序创建的所有文件),然后下载所选文件。我发现android有两个API Google Drive API和Google Drive REST API。在搜索了很多之后,我知道我可以使用RESTAPI获得文件列表,但不确定Android API。请指导我如何继续。

也可用于Android。你可以在这张照片上看到

/**
*获取最多10个文件名和ID的列表。
*@返回描述文件的字符串列表,如果没有文件,则返回空列表
*找到了。
*@抛出异常
*/
私有列表getDataFromApi()引发IOException{
//获取最多10个文件的列表。
List fileInfo=new ArrayList();
FileList结果=mService.files().list()
.setPageSize(10)
.setFields(“nextPageToken,文件(id,名称)”)
.execute();
List files=result.getFiles();
如果(文件!=null){
用于(文件:文件){
fileInfo.add(String.format(“%s(%s)\n”,
file.getName(),file.getId());
}
}
返回文件信息;
}
/**
 * Fetch a list of up to 10 file names and IDs.
 * @return List of Strings describing files, or an empty list if no files
 *         found.
 * @throws IOException
 */
private List<String> getDataFromApi() throws IOException {
    // Get a list of up to 10 files.
    List<String> fileInfo = new ArrayList<String>();
    FileList result = mService.files().list()
         .setPageSize(10)
         .setFields("nextPageToken, files(id, name)")
         .execute();
    List<File> files = result.getFiles();
    if (files != null) {
        for (File file : files) {
            fileInfo.add(String.format("%s (%s)\n",
                    file.getName(), file.getId()));
        }
    }
    return fileInfo;
}