如何以编程方式从Android应用程序检查Google云端硬盘上的可用空间

Raa*_*Raa 2 android google-drive-api

我正在尝试从我的Android应用程序上传文件,我能够.但在此之前,我想查看Google云端硬盘上的可用空间.

我正在使用Google Drive API(版本2).我尝试了多个选项,但无法找到该信息.

有人可以告诉我如何获取Google云端硬盘的免费空间.

A.S*_*.S. 5

看看这个伟大的样本:文档

private static void printAbout(Drive service) {
   try {
     About about = service.about().get().execute();

     System.out.println("Current user name: " + about.getName());
     System.out.println("Root folder ID: " + about.getRootFolderId());
     System.out.println("Total quota (bytes): " + about.getQuotaBytesTotal());
     System.out.println("Used quota (bytes): " + about.getQuotaBytesUsed());
         // TOTAL - USED = FREE SPACE
   } catch (IOException e) {
     System.out.println("An error occurred: " + e);
   }

}
Run Code Online (Sandbox Code Playgroud)