Google Drive Android API Trash Sample app demonstrates trashing of DriveResources via the Google Drive Android API available in Google Play Services. Only DriveResources accessible to an app can be trashed/untrashed. For full API details check Google Drive Android API Reference.
To trash a DriveResource use the trash and untrash methods from the DriveResourceClient, see guide here. Trash does not permanently remove the file like delete. The app must have access to the file or folder to trash. To successfully trash a DriveFolder, all child resources must be accessible.
- Install the Android SDK.
- Download and configure the Google Play services SDK, which includes the Google Drive Android API.
- Create Google API Console project and/or enable the Drive API for an existing project.
- Register an OAuth 2.0 client for the package 'com.google.samples.drive.trash' with your own debug keys. See full instructions in the Getting Started guide.
Add DriveFiles or DriveFolders to the currently selected DriveFolder by clicking the appropriate "ADD" button. Long press on a DriveResource to switch its trash status. Note that child resources of DriveFolders take on the same trash state as their parent folder.