5

I'd appreciate some help with the problem I am experiencing with google drive. I have searched all over for information on this issue but found none. Here's my problem:

I am developing an Android app, part of which uses Google Drive to save downloaded images. The correct behaviour is as follows:

  • Download image

  • Check if there is a saved drive id for a google drive folder where we want to save the image. If there is a saved id, then get the folder - if there is no id, it means that there is no folder, so create it

  • Now check if the folder is trashable, if it is, check if it is trashed. If it is trashed then untrash it

  • Put the image in the folder

In testing an app everything works as expected and I am able to view the folder and images in the google drive app both on the testing device (a phone) and on the web using my laptop The problem occurs when I trash the folder (either in the google drive app on the web or in the google drive app on the phone by selecting Remove). Now:

  • I download an image and look for the folder, the folder is found using the saved drive id
  • It returns true as being trashable but false as being trashed and the downloaded image is saved
  • However, the folder is not visible in the google drive app on the phone and is visible as trashed in the google drive app on the web
  • Restoring the trashed folder on the web and then syncing the phone, displays the folder in google drive on the phone. The downloaded images are all there

So, although the folder is recognized as being trashable, why is it not recognised as being trashed (when i fact it has been trashed)? here’s the code:

if (metadataResult.getMetadata().isTrashable()) {
    Log.i(TAG, "the folder is trashable");
    if (metadataResult.getMetadata().isTrashed()) {
        Log.i(TAG, "the folder is trashed");
        DriveFolder myDriveFolder = Drive.DriveApi
                .getFolder(googleApiClient, metadataResult.getMetadata().getDriveId());
        Log.i(TAG, "untrashing folder...");
        myDriveFolder.untrash(googleApiClient);
    }
}

I'd appreciate any help with this. Thanks in advance.

Clive Sargeant
  • 622
  • 11
  • 24
  • 1
    This is probably a sync'ing delay issue. The Drive app and the Drive Android API service don't currently use the same cache. – Dan McGrath Jul 06 '15 at 15:45

0 Answers0