Skip to content

Files

Latest commit

a603405 · Mar 20, 2018

History

History
This branch is 40 commits behind googleworkspace/android-samples:master.

trash

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018
Mar 20, 2018

Google Drive Android API Trash Sample

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.

How to Trash Files

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.

Setup

  1. Install the Android SDK.
  2. Download and configure the Google Play services SDK, which includes the Google Drive Android API.
  3. Create Google API Console project and/or enable the Drive API for an existing project.
  4. 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.

Run the Sample

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.

Folder View