Di chuyển từ API Google Drive dành cho Android
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
API Drive cho Android không còn được dùng kể từ ngày 6 tháng 12 năm 2018 và sẽ ngừng hoạt động hoàn toàn vào ngày 1 tháng 2 năm 2023.
Dòng thời gian
Ngày |
Trạng thái Drive Android API |
Ngày 6 tháng 12 năm 2018 |
Việc ngừng cung cấp được thông báo công khai. Các ứng dụng hiện có sẽ có thể truy cập vào API như bình thường, nhưng phải bắt đầu ngay quy trình di chuyển. Các ứng dụng mới không được sử dụng API này.
|
Ngày 21 tháng 10 năm 2019 |
API Drive Android sẽ bị xoá khỏi bản phân phối SDK Dịch vụ Google Play. Các ứng dụng sẽ không thể tạo cho đến khi bạn xoá phần phụ thuộc Drive Android API, nhưng các bản dựng hiện có sẽ không bị ảnh hưởng. Tài liệu công khai về Drive Android API sẽ không còn nữa.
|
Ngày 3 tháng 3 năm 2022 |
API Drive cho Android không được dùng nữa và tất cả lệnh gọi API đều không hoạt động. Khách hàng phải di chuyển trước ngày này.
|
Ngày 1 tháng 2 năm 2023 |
API Drive cho Android sẽ ngừng hoạt động hoàn toàn và mọi nỗ lực kết nối đều không thành công.
|
Sử dụng API REST của Drive
Drive REST API cung cấp chức năng tương tự như Drive Android API, bao gồm cả các cách để:
Để giảm bớt nỗ lực di chuyển ứng dụng, chúng tôi cung cấp một ứng dụng mẫu minh hoạ từng giải pháp thay thế được đề xuất ở trên. Ví dụ này cũng cho biết cách tạo, sửa đổi và truy vấn các tệp của người dùng trên Drive bằng REST API. Nếu bạn gặp vấn đề, hãy xem thẻ google-drive-api trên StackOverflow.
Di chuyển
Vì Drive Android API không được dùng nữa và tất cả lệnh gọi API đều không hoạt động, hãy đảm bảo rằng ứng dụng của bạn không còn gọi API này nữa. Để làm việc này, hãy xoá mã khởi tạo API: addApi(Drive.API)
.
Nếu bạn không di chuyển từ Drive Android API và ứng dụng của bạn cố gắng gọi API này, thì thông báo lỗi sau sẽ được trả về:
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}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-04 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-04 UTC."],[],[],null,["# Migrate from the Google Drive Android API\n\n**The Drive Android API is deprecated as of December 6, 2018 and will be fully\nturned down on February 1, 2023**.\n\nTimeline\n--------\n\n| Date | Drive Android API status |\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| December 6, 2018 | Deprecation is [publicly announced](https://cloud.google.com/blog/products/application-development/sync-google-drive-files-to-apps-using-the-drive-rest-api-bidding-farewell-to-the-drive-android-api). Existing clients will be able to access the API normally, but should immediately commence with migration efforts. New clients must not use the API. |\n| October 21, 2019 | The Drive Android API is removed from the Google Play Services SDK distribution. Apps will be unable to build until removing the Drive Android API dependency, but existing builds will be unaffected. The Drive Android API public documentation will no longer be available. |\n| March 3, 2022 | The Drive Android API is deprecated and all API calls are non-operational. Clients must migrate by this date. |\n| February 1, 2023 | The Drive Android API will be fully turned down and all connection attempts will be unsuccessful. |\n\nUse the Drive REST API\n----------------------\n\nThe Drive REST API offers the same functionality as the Drive Android API,\nincluding ways to:\n\n- Share and collaborate as you expect from Drive. You can [manage permissions or prompt the Share dialog](/workspace/drive/api/guides/manage-sharing) to users as needed. The REST API also allows for commenting on files, allowing your app to interact with the conversation around a file.\n- Search for files using [`files.list`](/workspace/drive/api/v3/reference/files/list), based on traditional indexing or [your own customized, indexable text](/workspace/drive/api/guides/file).\n- Detect changes to files through the [Changes collection](/workspace/drive/api/v3/reference/changes) and to any shared with the user through [shared drives](/workspace/drive/api/guides/enable-shareddrives).\n- Export and convert Google Docs so that your app can easily [open a user's document](/workspace/drive/api/guides/integrate-open#specific).\n\nTo ease client migration efforts, a\n[sample app](https://github.com/googleworkspace/android-samples/tree/master/drive/deprecation) is provided which\ndemonstrates each of the proposed replacements above. It also shows how to\ncreate, modify, and query for a user's Drive files using the REST API. If you\nhave any issues, check out the\n[google-drive-api](https://stackoverflow.com/questions/tagged/google-drive-api?tab=Newest)\ntag on StackOverflow.\n\nMigration\n---------\n\nSince the Drive Android API is deprecated, and all API calls are\nnon-operational, make sure your app is no longer calling the API. To do this,\nremove the code that initializes the API: `addApi(Drive.API)`.\n\nIf you don't migrate from the Drive Android API, and your app attempts to call\nthe API, the following error message is returned:\n\n`com.google.android.gms.common.api.ApiException: 17: API: Drive.API is not\navailable on this device. Connection failed with:\nConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}`"]]