This API is deprecated. Clients must migrate to the Drive REST API or another suitable solution to avoid disruptions to your application.

Storing app data

The Google Drive API includes a special hidden folder that your app can use to store application specific data.

What is the App Folder?

The App Folder is a special folder that is only accessible by your application. Its content is hidden from the user and from other apps. Despite being hidden from the user, the App Folder is stored on the user's Drive and therefore uses the user's Drive storage quota. The App Folder can be used to store configuration files, temporary files, or any other types of files that belong to the user but should not be tampered with.

Even though users can't see the App Folder's content, they can see the amount of storage used by your App Folder in the Manage Apps dialog:

Manage apps dialog showing Application Data folder size

Your App Folder is deleted if users uninstall your app from their Drive. They can also delete your app's App Folder manually using the Options menu in the Manage Apps dialog.

Get authorization to use the App Folder

To be able to use your App Folder, your application must request the SCOPE_APPFOLDER scope as part of authorization.

Get the App Folder

The App Folder can be retrieved by using the DriveResourceClient.getAppFolder method. It can then be used similarly to a normal folder. For example, you can use the DriveResourceClient.queryChildren method to list the files in the App Folder.

Check if a file or folder is in the App Folder

You can check whether a file or folder is in the App Folder by retrieving its metadata. The Metadata.isInAppFolder method returns true if the file or folder is in the App Folder.

Create a file in the App Folder

Creating a file in the App Folder is the same as for a normal folder. The following example demonstrates creating a new text file named New File.txt in the App Folder:

private void createFileInAppFolder() {
    final Task<DriveFolder> appFolderTask = getDriveResourceClient().getAppFolder();
    final Task<DriveContents> createContentsTask = getDriveResourceClient().createContents();
    Tasks.whenAll(appFolderTask, createContentsTask)
            .continueWithTask(task -> {
                DriveFolder parent = appFolderTask.getResult();
                DriveContents contents = createContentsTask.getResult();
                OutputStream outputStream = contents.getOutputStream();
                try (Writer writer = new OutputStreamWriter(outputStream)) {
                    writer.write("Hello World!");

                MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
                                                      .setTitle("New file")

                return getDriveResourceClient().createFile(parent, changeSet, contents);
                    driveFile -> {
            .addOnFailureListener(this, e -> {
                Log.e(TAG, "Unable to create file", e);