google-drive-android-api , Handling of Thumbnails in Google Drive Android API (GDAA)


Handling of Thumbnails in Google Drive Android API (GDAA)

Question:

Tag: google-drive-android-api

I've run into the following problem when porting an app from REST API to GDAA.
The app needs to download some of (thousands of) JPEG images based on user selection. The way this is solved in the app is by downloading a thumbnail version first, using this construct of the REST API:

  private static InputStream getCont(String rsid, boolean bBig){
    InputStream is = null;
    if (rsid != null) try {
      File gFl = bBig ?
      mGOOSvc.files().get(rsid).setFields("downloadUrl"  ).execute():
      mGOOSvc.files().get(rsid).setFields("thumbnailLink").execute();
      if (gFl != null){
        GenericUrl url = new GenericUrl(bBig ?  gFl.getDownloadUrl() : gFl.getThumbnailLink());
        is = mGOOSvc.getRequestFactory().buildGetRequest(url).execute().getContent();
      }
    } catch (UserRecoverableAuthIOException uraEx) {
      authorize(uraEx.getIntent());
    } catch (GoogleAuthIOException gauEx) {}
    catch (Exception e) { }
    return is;
  }

It allows to get either a 'thumbnail' or 'full-blown' version of an image based on the bBig flag. User can select a thumbnail from a list and the full-blown image download follows (all of this supported by disk-base LRU cache, of course).
The problem is, that GDAA does not have an option to ask for reduced size / thumbnail version of an object (AFAIK), so I have to resort to combining both APIs, which makes the code more convoluted then I like (bottom of the page). Needles to state that the 'Resource ID' needed by the REST may not be immediately available.
So, the question is: Is there a way to ask GDAA for a 'thumbnail' version of a document?


Answer:

Downloading thumbnails isn't currently available in the Drive Android API, and unfortunately I can't give a timeframe to when it will be available. Until that time, the Drive Java Client Library is the best way to get thumbnails on Android.

We'd appreciate if you go ahead and file a feature request against our issue tracker: https://code.google.com/a/google.com/p/apps-api-issues/

That gives requests more visibility to our teams internally, and issues will be marked resolved when we release updates.


Related:


Delete / trash file from android using android.gms.drive


java,android,google-drive-sdk,google-drive-android-api
I need to delete files from Google Drive using com.google.android.gms.drive. From what I've read here and across the web there is no support for file deletion in the "new API". Is that (still) correct? I mean the API isn't that new anymore ... I also read about the "clear contents...

Cannot access Google Drive from 2 different device


java,android,google-drive-sdk,google-drive-android-api
I have an app which creates a word file on the Google Drive with some text. If I try to access the word file on the Google Drive from the device In which I have created that file, then it works and everything thing goes smooth, and I can able...

Handling of Thumbnails in Google Drive Android API (GDAA)


google-drive-android-api
I've run into the following problem when porting an app from REST API to GDAA. The app needs to download some of (thousands of) JPEG images based on user selection. The way this is solved in the app is by downloading a thumbnail version first, using this construct of the...

cannot get folderId that i just created on google drive


android,google-drive-sdk,google-play-services,google-drive-android-api
public class Helpers extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { SharedPreferences preferences; private static final String TAG = "BaseDriveActivity"; public static String EXISTING_FOLDER_ID; protected static final int REQUEST_CODE_RESOLUTION = 1; protected static final int NEXT_AVAILABLE_REQUEST_CODE = 2; public static final String folderId = "FOLDER_ID"; public static final String fileName = "folderId";...

Unable to get custom property via Android Drive API


google-drive-android-api
Create a file and query file with custom property work fine, but it cannot retrieve custom property in queryChildren() ResultCallback. Here is the CustomProperty definition: /** * CustomPropertyKey: Uploaded file's hash code */ public static final CustomPropertyKey CustomPropertyKeyFileHash = new CustomPropertyKey("fileHash", CustomPropertyKey.PUBLIC); query conditions: Query query = new Query.Builder() .addFilter(...

How to send multiple images those are present in folder to the google drive in android programmatically?


android,image,google-drive-android-api,file-manager
I want to send multiple images those are present in my internal storage and when i selects that folder i want upload that folder into google drive. i have tried this google drive api for android https://developers.google.com/drive/android/create-file and i have used the below code but it shows some error in...

Upload text file to Google Drive using Android


java,android,google-drive-sdk,google-drive-android-api
Edited: I have set my text into a string like so: String text = ("Hello!"); I want to turn this into a plain text file and then upload to a Google Drive Folder. I have tried on the code below, but it is not complete so I cannot say what...

Dependency ignored because of conflict Android studio


android,gradle,google-drive-android-api
I'm trying to add the following dependency but it is ignore. I can't understand how to resolve it please help me Thank you. Dependency compile 'com.google.apis:google-api-services-drive:v2-rev170-1.20.0' Waring for ignoring dependency Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case...

Get Access Token From Google Drive API by GoogleAuthUtil in Android


android,oauth-2.0,google-drive-android-api
I got a weird problem in using GoogleAuthUtil when accessing the Google Drive API. Following is my code, @Override protected String doInBackground(String... params){ String accountName = params[0]; //String scopes = "oauth2:profile email"; // This can work ! String scopes = "oauth2:server:client_id:7666010xxxxx-dm0d37oxxxxxxxih8k5sm5g7tajetubk.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/drive"; String token = null; try{ token = GoogleAuthUtil.getToken(getApplicationContext(), accountName,...

Couldn't append the text onto a Google Drive File


java,android,android-activity,google-drive-android-api
I am trying to append text to a text file on the Google Drive. But when I write, it whole file is overwritten. Why can't I just add the text in the end of the file? DriveFile file = Drive.DriveApi.getFile(mGoogleApiClient, id); file.open(mGoogleApiClient, DriveFile.MODE_WRITE_ONLY, null).setResultCallback(new ResultCallback<DriveApi.DriveContentsResult>() { @Override public void onResult(DriveApi.DriveContentsResult...

The lightest (most lightweight) Google Drive REST API query/response?


google-drive-sdk,google-drive-android-api
When initializing the REST Google Drive API in an Android app, I need to 'poke' the server to produce the UserRecoverableAuthIOException In order to minimize the network traffic, I'm searching for the most 'lightweight' request that would produce such an exception. Currently, I use the following construct: com.google.api.services.drive.Drive svc; svc.files().get("root").setFields("title").execute();...

“Cannot find DriveId. Are you authorized to view this file?”: Even if EXISTING_FOLDER_ID is set manually


android,google-api,google-drive-sdk,google-api-java-client,google-drive-android-api
I am having a look at here from github. I can create a file and a folder successfully by reading the code provided in github. But I am not being able to edit the file or create a file/folder in any specific folder. The main problem would be using emulator,...

Google OAuth 2.0 and debug key for Google Drive API


android,google-oauth,google-drive-android-api
I've set up 2 Client IDs for Android application in the GoogleDriveAPI console: the first for the release APK and the second for Debug purposes. Everything ok with the released app, but my issue is only related to the second Client ID. I'm getting this exception: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException after the following...

Using Google Drive to backup and restore SQLite Database


android,google-drive-sdk,google-drive-android-api
I've managed to create a backup of my database on an SD card and restore from there but realized that the purpose of my backup is to ensure the safety of the data and in this case if the physical device itself is damaged, lost, or spontaneously combusts so will...

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


google-drive-sdk,google-drive-android-api
I've run into this issue a few times, but could never point my finger on it, attributing it to GDAA's latency, my buggy code, etc... I finally managed to come up with a scenario where I can safely reproduce it, so I would like to ask people who know if...

Error com.google.android.gms.drive.DriveApi.DriveContentsResult cannot be resolved


android,google-drive-sdk,google-drive-android-api
I am working on Android Google Drive. As of now I am using the github sample code Android Demos. I am getting an error of The import com.google.android.gms.drive.DriveApi.DriveContentsResult cannot be resolved and The import com.google.android.gms.drive.DriveContents cannot be resolved I am using the updated Google play service and I have imported...

Google Drive Android SDK: where to start from?


google-drive-sdk,google-drive-android-api
I have been looking all day at the Google Drive SDK for Android, but I am a bit confused. I need to make the list of folders and files in the user Google Drive account. I thought that was a simple, basic standard feature, but maybe not... Please can you...