從 Google Drive Android API 遷移

自 2018 年 12 月 6 日起,雲端硬碟 Android API 已淘汰,並將於 2023 年 2 月 1 日全面停用

時間軸

日期 Drive Android API 狀態
2018 年 12 月 6 日 公開宣布淘汰。現有用戶端仍可正常存取 API,但應立即開始進行遷移作業。新用戶不得使用此 API。
2019 年 10 月 21 日 Google Play 服務 SDK 發布內容已移除 Drive Android API。您必須先移除 Drive Android API 依附元件,才能建構應用程式,但現有建構作業不會受到影響。Google 雲端硬碟 Android API 公開文件將不再提供。
2022 年 3 月 3 日 Google 雲端硬碟 Android API 已淘汰,所有 API 呼叫都無法運作。客戶必須在此日期前完成遷移。
2023 年 2 月 1 日 屆時,Android 版雲端硬碟 API 將全面停用,所有連線嘗試都會失敗。

使用 Drive REST API

雲端硬碟 REST API 提供與雲端硬碟 Android API 相同的功能,包括:

為簡化用戶端遷移作業,我們提供範例應用程式,展示上述每項建議的替代方案。此外,本文也會說明如何使用 REST API 建立、修改及查詢使用者的雲端硬碟檔案。如有任何問題,請查看 StackOverflow 上的 google-drive-api 標記。

遷移

由於 Google 雲端硬碟 Android API 已淘汰,所有 API 呼叫都無法運作,請確保應用程式不再呼叫該 API。如要這麼做,請移除初始化 API 的程式碼:addApi(Drive.API)

如果您未從 Drive Android API 遷移,且應用程式嘗試呼叫 API,系統會傳回下列錯誤訊息:

com.google.android.gms.common.api.ApiException: 17: API: Drive.API is not available on this device. Connection failed with: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}