google-drive-android-api

It's possible to use google drive REST API and Android API in the same project?

♀尐吖头ヾ 提交于 2019-11-28 14:27:20
I have a project that was build using the google drive android API, but i want to share a file uploaded to my cloud, and I read in another question here that this is just possible using the REST API. So I ask you, there is a way to work with the both API's in the same project? thanks seanpj Yes, it is possible. Just looking at the this ' Lifecycle of a Drive file ', you can imagine your app on top of that picture (Android App) and the REST Api on the bottom (Drive Service). There is a few points to keep in mind, though: 1/ The GDAA's main identifier, the DriveId lives in GDAA (GooPlaySvcs)

Google Drive Android API - Invalid DriveId and Null ResourceId

依然范特西╮ 提交于 2019-11-28 14:02:35
I have been battling this code the whole day without luck. I started by following this code sample from Google. The problem is that the folder gets created successfully but inside onResult() , I always get a DriveId or resourceId that is invalid or incomplete. That means I cannot create a file inside the folder I created. Here is the code I am using: public class CreateFolderActivity extends BaseDemoActivity { @Override public void onConnected(Bundle connectionHint) { super.onConnected(connectionHint); MetadataChangeSet changeSet = new MetadataChangeSet.Builder() .setTitle("MyAppFolder").build

Google OAuth 2.0 and debug key for Google Drive API

泪湿孤枕 提交于 2019-11-28 11:45:52
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 lines: Drive.Files.List request; request = service.files().list(); String query = "mimeType='application/vnd.google-apps.folder' AND trashed=false AND title='" + title + "' AND '" + parentId + "' in parents"; request = request.setQ

Uploading video to Google Drive programmatically (Android API)

馋奶兔 提交于 2019-11-28 08:45:21
I have followed the Drive API guide ( https://developer.android.com/google/play-services/drive.html ) and my app now uploads photos smoothly, but I am now trying to upload videos (mp4) without success. Does anyone know how to achieve this? The video is a newly generated mp4 file and I have the path to where it is stored on the device. For pictures its done like this: Drive.DriveApi.newDriveContents(mDriveClient).setResultCallback( new ResultCallback<DriveContentsResult>() { @Override public void onResult(DriveContentsResult result) { if (!result.getStatus().isSuccess()) { Log.i(TAG, "Failed to

Backup/Restore SQLlite Database to Google Drive app folder

孤者浪人 提交于 2019-11-28 06:38:21
I am trying to incorporate the functionality to backup and restore the app database to google drives app folder (NOT visible to the user). I went through the basic setup guide setup guide given for android and can get the user to authorize the app and reach to the point where onConnected method is being called. The problem that I am facing is, I am not sure how to go about 'sending' the database file (.db) from device to google drive app folder. Google has shared snippet for creating a new file but that's about it. I did find a previously asked question vaguely similar to what I am looking for

List all files in Drive

元气小坏坏 提交于 2019-11-28 04:11:36
问题 I want to list all files in Root folder of user's Drive using Google Drive API for Android. What I've tried: Use SCOPE_FILE and listChildren : mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); Then list files: Drive.DriveApi.getRootFolder(mGoogleApiClient) .listChildren(mGoogleApiClient) .setResultCallback(new ResultCallback<DriveApi.MetadataBufferResult>() {

Android - How to download the file from google drive to android SDCARD?

大兔子大兔子 提交于 2019-11-28 02:08:44
问题 I have uploaded an apk file in google drive using the desktop. Now I need to download that apk file to in to my android SDCARD when I click on a button in my android activity. How to achieve this. 回答1: First, you have to use the RESTful API, since you have to open Drive in a DRIVE_FILE scope. The GDAA has only FILE scope and will not see anything your Android app did not create. In the RESTful API, it is a 3 step process use LIST to get the file URL (query by 'title') use GET (actually

How to get Google Drive file ID

左心房为你撑大大i 提交于 2019-11-28 01:38:55
I've created a file to Drive root using Google Drive Android API. How can I get this file ID to share it using Google Client Library? Getting DriveFileResult in ResultCallback<DriveFileResult> callback returns Null: String fileId = result.getDriveFile().getDriveId().getResourceId(); The callback is to the file being created locally. The DriveId will only have a resourceId when the file is synced to the server. Until then getResourceId will return null. https://developer.android.com/reference/com/google/android/gms/drive/DriveId.html#getResourceId() Use CompletionEvents to be notified when

Get all folders google drive api on Android

耗尽温柔 提交于 2019-11-28 01:24:43
I use the new Google drive api and I can't get All folders from my google drive, I only get the folders that I create with the google drive api... Anybody know why happens this? this is my code: @Override protected void onResume() { super.onResume(); if (mGoogleApiClient == null) { // Create the API client and bind it to an instance variable. // We use this instance as the callback for connection and connection // failures. // Since no account name is passed, the user is prompted to choose. mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE)

How to Clear GoogleApiClient Default Account and Credentials

冷暖自知 提交于 2019-11-27 16:36:13
问题 I connect a GoogleApiClient for use with Google Drive. I build the client like this: GoogleApiClient.Builder(this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); My experience has been that the first time a connection request is made for this client, the AccountPicker dialog is presented and the consent screen for Google Drive. If the user selects an account, consents, and the connection completes successfully, the