google-drive-android-api

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

左心房为你撑大大i 提交于 2019-12-02 11:48:12
问题 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 and forget"-strategy, but I'd like not to follow that approach. Part 2 of the question: Given it's still impossible to delete files via the API mentioned above; is there any easy way to combine the REST API w/ the

Upload file into google drive folder using Xamarin.Android

主宰稳场 提交于 2019-12-02 09:43:50
问题 I want to create file inside a specific folder in google drive ( not the default location ) using Xamarin.Andriod I'm using the below code MetadataChangeSet changeSetfile = new MetadataChangeSet.Builder() .SetTitle("Test.jpg") .SetMimeType("image/jpeg") .Build(); DriveClass.DriveApi .GetRootFolder(_googleApiClient) .CreateFile(_googleApiClient, changeSetfile, contentResults.DriveContents); 回答1: Implement GoogleApiClient.IConnectionCallbacks Obtain a GoogleApiClient with DriveClass.API and

GoogleApiClient Calling connect() while still connected, missing disconnect()

醉酒当歌 提交于 2019-12-02 09:42:01
1) Calling connect() while still connected, missing disconnect() .This error occurs in following scenario, Switch off Wifi and launch my App First time. I try to connect GoogleAPiClient onCreate() of Activity Got Error dialog, Network Error:A data connection is required to connect to GoogleApiClient. So Switch ON WIFI, again open my App. Got connect() while still connected, missing disconnect() error. From my debugging I found,no GoogleApiClient connection callback methods are called when this occurs. Note : This error not occurs, if I remove my google account from my device and add again.

Filters.ownedByMe doesn't work in 'Drive API for Android' (But works correctly in 'API Client Library for Java')

眉间皱痕 提交于 2019-12-02 08:35:33
Previously, I'm using "API Client Library for Java" to perform file search in appdata folder. File searching code in API Client Library for Java private static void searchFromGoogleDrive(Drive drive, String qString) { try { Files.List request = drive.files().list().setQ(qString); do { FileList fileList = request.execute(); for (com.google.api.services.drive.model.File f : fileList.getItems()) { final String title = f.getTitle(); if (title == null || f.getDownloadUrl() == null || f.getDownloadUrl().length() <= 0) { continue; } ... } request.setPageToken(fileList.getNextPageToken()); } while

Accesing google drive API for a specific account

雨燕双飞 提交于 2019-12-02 08:34:09
I'm trying to access google drive through my android app for a specific account. In addition, I also have sign in with google option, so that users can login to the app through google+ and this will be the google account which play services is using. However, I want to store some files on a specific google drive account say abcd@gmail.com . I tried using the GoogleAPIClient by specifying DRIVE API, required scopes and an account name as 'abcd@gmail.com', which looks something like below: serviceClient = new GoogleApiClient.Builder(this) .addApi(Drive.API) .setAccountName("abcd@gmail.com")

Google Drive Android Api Completion Event for Folder Creation

人盡茶涼 提交于 2019-12-02 08:17:48
问题 The completion events in Google Drive Android Api (GDAA) seem to be invoked only by contents change (file create, file contents update). Since I need to retrieve a Resource Id of a folder (seen here for a file with contents), referring to this method: DriveFolder.createFolder(mGAC, meta).setResultCallback(...); I need a completion event for a folder creation, but I can't find a solution. Any hints? Thank you. 回答1: No, takers for this question, so I assume there is no straightforward solution.

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

六月ゝ 毕业季﹏ 提交于 2019-12-02 05:59:44
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 and forget"-strategy, but I'd like not to follow that approach. Part 2 of the question: Given it's still impossible to delete files via the API mentioned above; is there any easy way to combine the REST API w/ the code I've already written? Something like get token from GoogleApiClient fire DELETE request w/ token

Google Drive Android Api Completion Event for Folder Creation

那年仲夏 提交于 2019-12-02 04:47:38
The completion events in Google Drive Android Api ( GDAA ) seem to be invoked only by contents change (file create, file contents update). Since I need to retrieve a Resource Id of a folder ( seen here for a file with contents ), referring to this method: DriveFolder.createFolder(mGAC, meta).setResultCallback(...); I need a completion event for a folder creation, but I can't find a solution. Any hints? Thank you. seanpj No, takers for this question, so I assume there is no straightforward solution. Meanwhile, I slammed together a hack until this gets fixed (if ever). 1/ Create a folder, you

Google Drive SDK - Drive Scopes

柔情痞子 提交于 2019-12-02 04:15:22
问题 I am trying to use this: https://developers.google.com/drive/android/get-started Which is the Google drive SDK for Android. I want to be able to list all files in a users Google drive account. But only access is given to files and folders that the app created (or that the user selects). mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); Can Google Devs tell me if it is

Enforce Drive API for Android to work online mode only

只谈情不闲聊 提交于 2019-12-02 04:09:04
Recently, I just manage to migrate Drive API related code from Google APIs Client Library for Java to Google Play services client library The following code is search a file in appdata folder, then download it as temp file. private static GoogleCloudFile searchFromGoogleDrive(GoogleApiClient googleApiClient, HandleStatusable h, PublishProgressable p) { DriveFolder driveFolder = Drive.DriveApi.getAppFolder(googleApiClient); final String titleName = ("my-title"); Query query = new Query.Builder() .addFilter(Filters.and( Filters.contains(SearchableField.TITLE, titleName), Filters.eq