Google Drive folder not recognized when broken in Android app

I would appreciate help in resolving the problem that I encountered with Google Drive. I searched all the information about this problem but could not find it. Here is my problem:

I am developing an Android application, part of which uses Google Drive to save uploaded images. The correct behavior is as follows:

  • Upload image

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

  • Now check if the folder is deleted, if there is one, check if it is damaged. If it is aligned, then do not open it

  • Put image in folder

When testing the application, everything works as expected, and I can view the folder and images in the Google application for Google both on the test device (phone) and on the Internet using my laptop. The problem occurs when I delete the folder (or in the Google application Drive on the web or in the Google app on your phone by selecting “Delete”). Now:

  • I load the image and look for the folder, the folder is found using the saved disk identifier
  • It returns true as trashable, but false as cropped and the uploaded image is saved
  • However, the folder does not appear in the Google Drive app on the phone and is visible as a crack in the Google Google app on the web.
  • , , Google .

, trashable, ( )? heres :

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);
    }
}

. .

+4

All Articles