Trash, Delete in new Google Drive Android API?

2020-01-26 10:46发布

UPDATE (May 2015):
the 'trash' functionality has been implemented in GDAA, making the question below irrelevant.

ORIGINAL QUESTION:
As I play with the new "Google Drive Android API" (GDAA), I am running into a few discrepancies I can't figure out. Basically, I have an old app that uses the "com.google.api.services.drive" interface (insert, patch, update) and I WOULD LOVE to port it to GDAA.

First, GDAA vs. drive.google.com web app.
With the old service, I used the DriveScopes.DRIVE_FILE scope, so I assumed similar behavior/results. Files created with the old "DriveScopes.DRIVE_FILE" can be deleted by me (the Drive owner) in "https://drive.google.com" (I assume that my scope is DRIVE there) and subsequent Android app queries will not find them. It behaves as I would expect:

  1. The Android app creates files.
  2. User deletes them on "drive.google.com".
  3. Android app does not see them anymore.

With the new GDAA, it does not seem to work. Which brings me to the second point:

DELETE/TRASH functionality.
I was trying to test CRUD functionality and couldn't find DELETE at all (again, it may be my ignorance/shortsightedness). Deleting them from "drive.google.com" makes them invisible there, but the Android app still sees them. Metadata can inquire through "isTrashed()", but there is nothing in "MetadataChangeSet.Builder" that would let me delete/trash them, only setMimeType(), setStarred(), setTitle().

I'm lost, please help.

7条回答
我欲成王,谁敢阻挡
2楼-- · 2020-01-26 11:21

As of Google Play services 7.5, both delete and trash are supported: https://developers.google.com/drive/release-notes#drive_android_api_google_play_services_75_-_may_28th_2015

We recommend using trash for user visible files rather than delete, to give users the opportunity to restore any accidentally trashed content. Delete is permanent, and recommended only for App Folder content, where trash is not available.

查看更多
登录 后发表回答