簡體   English   中英

谷歌驅動器配額使用android api驅動器

[英]google drive quota using android api for drive

如何獲得用戶的Google雲端硬盤帳戶的存儲空間和已用配額? 我正在使用用於驅動器的android api構建一個android應用程序: https : //developers.google.com/drive/android/

我找不到任何可以為我返回詳細信息的方法,但是,我相信我必須使用如下所示的調用rest api: https : //developers.google.com/drive/v2/reference/about/get 如何檢索驅動器服務實例? 我已經有了可以與驅動器API進行通信的mGoogleAuthClient。 有什么幫助嗎?

像這樣:

com.google.android.gms.common.api.GoogleApiClient mGAC = new GoogleApiClient
  .Builder(this)
  .addApi(com.google.android.gms.drive.Drive.API)
  .addScope(com.google.android.gms.drive.Drive.SCOPE_FILE)
  .addConnectionCallbacks(this)
  .addOnConnectionFailedListener(this)
  .setAccountName(email)
  .build(); 

com.google.api.services.drive.Drive mGSvc = new Drive
  .Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(),
  GoogleAccountCredential
    .usingOAuth2(this, Collections.singletonList(DriveScopes.DRIVE_FILE))
    .setSelectedAccountName(email)
  ).build();
  }

使您可以訪問GDAAREST Apis。

但是請記住以下幾點:

這意味着將兩者混合需要一些時序考慮

祝好運。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM