1

Does anyone know, if google still plans to implement a delete functionality to their google drive android api?

To my astonishment, when implementing the last piece of some automatically scheduled 'cloud-backup' code using the 'drive android api' (using the latest Google Play service version, revision 22), I discovered that I was not able to delete files.

I found this hack here on stackoverflow, to mix in the 'Drive API Client Library for Java' for the delete part. I don't like this idea and would like to avoid this solution. Additionally someone from google posted in January 2014 that a delete/trash functionality was 'coming soon' and it's March 2015 now...

Does anyone have a update/solution on this?

EDIT 24 March 2015: The delete call is now natively supported by the Google Android Drive API. You just need to update your Play services lib to revision >= 23. Details: https://developers.google.com/drive/android/trash

Community
  • 1
  • 1
darksaga
  • 2,166
  • 2
  • 18
  • 21
  • Please read this answer to [SO 29034693][1]. [1]: http://stackoverflow.com/questions/29034693/delete-trash-file-from-android-using-android-gms-drive – seanpj Mar 14 '15 at 13:13
  • ... and Burcu Dogan is not 'some google guy' :-). She's the one who originally took care of the demo code. But I think she's gone to the 'golang' universe now. – seanpj Mar 14 '15 at 13:59
  • Thanks for your input. The answer you linked, suggests exactly the 'hack' I was talking about above: Mixing the drive android api with the vanilla java drive api. I tried it today and it works, but I don't like this 'mixed' solution, as it needs additional app permissions & 6 additional jars. – darksaga Mar 14 '15 at 19:14
  • Luckily I can do the following in my code: if(driveFile exists){'update existing driveFile with new contents using DriveFile.MODE_WRITE_ONLY'}else{create new driveFile with new contents}. I also tried this approach today and it works smoothly and I like this solution much better (no additional jar dependencies). About the 'google guy': I looked at the stackoverflow profile & the linked twitter account, seems it was a 'google gal' with a first name I've never heard of ;-) – darksaga Mar 14 '15 at 19:15
  • Did you try to delete a file using REST and then write to it using GDAA's DriveId? I once managed to do it successfully 3 hours after deletion. Or create a file in a folder you've deleted long time ago? Maybe they fixed it, I don't know, I dropped GDAA half a year ago. Again, as I said in 29034693, GDAA is great, but think twice how you gonna use it. – seanpj Mar 14 '15 at 23:10
  • What I saw, when deleting files using the trash() + delete() call of the GDJA, is that after 5 minutes those files were still not marked as trashed when calling the listChildren() call of the GDAA. As you and other reported, there's still some delay. If I was dependend on trash() + delete() calls, I'd drop the GDAA and I'd use the GDJA. Interestingly, googles Drive App features a proper behavior: the GDJA deleted files were 'deleted' properly nearly instantaneously. Guess this app also uses the GDJA. – darksaga Mar 15 '15 at 14:29
  • 1
    The ability to trash Drive Resources is now available in GDAA: https://developers.google.com/drive/android/trash However at this time to delete you should still use GDJA. – Arthur Thompson Mar 23 '15 at 22:07
  • Just saw it myself, when looking at the Drive API Quickstart: https://developers.google.com/drive/android/trash With an updated google play services lib to revision 23, I just tried the new trash() call. It worked as expected... – darksaga Mar 24 '15 at 12:19

1 Answers1

2

UPDATE:

Delete is supported in the Google Drive Android API as of Google Play services 7.5 using the DriveResource.delete() method.

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.


Delete isn't currently available in the Drive Android API, but we are currently testing the behavior internally. It won't make the next Play services release, but we hope to have it in the one after; unfortunately I can't give a timeframe. Until that time, the Drive Java Client Library is the best way to do delete on Android.

If you have any other feature requests or bugs, we'd appreciate if you could file them against our issue tracker: https://code.google.com/a/google.com/p/apps-api-issues/

That gives requests more visibility to our teams internally, and issues will be marked resolved when we release updates.

Daniel
  • 1,239
  • 1
  • 13
  • 24