How do I switch accounts under the NEW Google Drive Android API

First, add the Plus.API: mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(Drive.API).addApi(Plus.API).addScope(Drive.SCOPE_APPFOLDER).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build(); Then you can switch accounts like this: public void onClick(View view) { if (view.getId() == R.id.sign_out_button) { if (mGoogleApiClient.isConnected()) { Plus.AccountApi.clearDefaultAccount(mGoogleApiClient); mGoogleApiClient.disconnect(); mGoogleApiClient.connect(); } } } For more, see here.

User disconnecting app in Drive causes loss of data under FILE scope

The first issue is: A user revokes authorization via: Settings > Manage Apps > Disconnect From Drive Then reauthorizes that App Files this App was authorized to see with DRIVE_FILE scope are no longer authorized. This is the expected behavior of the REST and Android APIs. We don’t think users would intuitively expect all previously … Read more

Deleted files status unreliably reported in the new Google Drive Android API (GDAA)

While waiting for any acknowledgement from the support team, I devised a HACK that allows a workaround for this problem. Using the same principle as in SO 22295903, the logic involves falling back to RESTful API. Basically, dropping the LIST / QUERY functionality of GDAA. The high level logic is: query the RESTful API to … Read more

Can someone provide an up-to-date Android guide for Google Drive REST API v3?

Before answering this question I want you to know that I got the code from here (https://ammar.lanui.online/integrate-google-drive-rest-api-on-android-app-bc4ddbd90820) and the documentation from Google was not much helpful for me. So this solution is from limited resources available to me. I need the drive to upload and download files from my app. In drive I have to … Read more

How to delete a file on google drive using Google Drive Android API

UPDATE (April 2015) GDAA finally has it’s own ‘trash‘ functionality rendering the answer below IRRELEVANT. ORIGINAL ANSWER: As Cheryl mentioned above, you can combine these two APIs. The following code snippet, taken from here, shows how it can be done: First, gain access to both GoogleApiClient, and …services.drive.Drive GoogleApiClient _gac; com.google.api.services.drive.Drive _drvSvc; public void init(MainActivity … Read more

cannot get folderId that i just created on google drive

Do not mix DriveId with ResourceId. Both look like strings, but DriveId is different from ResourceId. See SO 21800257. Also, ResourceId is not immediately available, see SO 22874657. DriveId usually looks like: “DriveId:CAESHDBCMW1RVblahblahblahblahMYjAUgssy8yYFRTTNKRU55” whereas ResourceId is more like: “UW2ablahblaghblahNy00Ums0B1mQ” UPDATE: Since so many developers fight this issue, I’ll try to elaborate as deep as my … Read more

Unpredictable result of DriveId.getResourceId() in Google Drive Android API

UPDATE (07/22/2015) Thanks to the prompt response from Steven Bazyl (see comments below), I finally have a satisfactory solution using Completion Events. Here are two minified code snippets that deliver the ResourceId to the app as soon as the newly created file is propagated to the Drive: File creation, add change subscription: public class CreateEmptyFileActivity … Read more