google-drive-android-api

Android Google DriveApi returning different DriveID for same title on different devices

你说的曾经没有我的故事 提交于 2019-12-05 21:35:22
So first of all I know that the DriveID for each file/folder is device specific, BUT the resourceId is constant and that's really what I'm using to test if the items are the same (besides the title of course). Problem I am trying to sync folders in my AppFolder across devices, however, I'm getting different files/folders on each device despite querying via the title before doing anything. So some code: How I set up the api client mGoogleApiClient = new GoogleApiClient.Builder(context.getApplicationContext()) .addApi(Drive.API) .addApi(Plus.API)//used for logout process .addScope(Drive.SCOPE

How to use the setResultCallback method?

ぐ巨炮叔叔 提交于 2019-12-05 12:42:17
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import android.app.Activity; import android.content.Intent; import android.content.IntentSender; import android.content.IntentSender.SendIntentException; import android.graphics.Bitmap; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient

Upload text file to Google Drive using Android

这一生的挚爱 提交于 2019-12-05 11:51:58
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 errors appear. I am using the Google Drive "Quick-start" Demo, and trying to tailor it for what I need. Link: https://github.com/googledrive/android-quickstart DriverClass: public class UploadDrive extends Activity implements ConnectionCallbacks,OnConnectionFailedListener { private static final String TAG = "androiddrivequickstart"; private static final int

Accessing public Google Drive folder from Android app without authenticating

江枫思渺然 提交于 2019-12-05 07:20:58
I'd like for my app to be able to read from a pre-defined shared public Google Drive folder without the user having to log in or choose a Google account. Background / Environment Using my desktop browser, I have created a public folder on my Google Drive that is set up to be public. Anyone with the link may access (read) the drive, so no authorization is required: In my Android Studio project, I have gone into File > Project Structure > Dependencies and added com.google.android.gms:play-services-drive:10.2.0 I now have the ability to create a new GoogleApiClient.Builder() . Question I have

Google Drive Android API returns success even after removing the app

这一生的挚爱 提交于 2019-12-05 04:03:45
I'm using the new Google Drive Android API. This is the demo code that I've copied from Google's android-samples repo . GoogleSignInAccount signInAccount = GoogleSignIn.getLastSignedInAccount(this); if (signInAccount != null && signInAccount.getGrantedScopes().containsAll(requiredScopes)) { initializeDriveClient(signInAccount); } else { ... } The issue I'm facing is, even if I remove the app from Drive, getLastSignedInAccount() is still returning the account and the operations (such as adding a file) on the accounts are still succeeding. Returning the GoogleSignInAccount object is fine, I

Google Drive integration using current activity

风格不统一 提交于 2019-12-05 01:25:09
Is it possible to integrate with Google Drive without creating ones own activity, instead just using the current activity for the application without polluting it with Google Drive related code? I have a background "service" (not an Android service - just a UI-agnostic class) that is responsible for loading some data from Google Drive. As a service, it has no real business being an activity. However, the samples for Drive integration have an override of onActivityResult to handle the situation where authentication is required. I'm not sure how I would get a hold of this information if my

Google Drive API is not working after Proguard obfucation

末鹿安然 提交于 2019-12-04 21:53:32
I am using compile 'com.google.android.gms:play-services-auth:10.0.1' compile 'com.google.android.gms:play-services-drive:10.0.1' to implement Google Drive in my Android app. The app is working well until i obfuscate the application with Proguard. Once the application is obfuscated, while i try to enable Google Drive Backup option, the app pop-ups the account selection dialog and doesn't proceed after that. In the debug version of the app, while i try to enable Google Drive Backup option, the app pop-ups the account selection and then proceed to Google Drive Permission dialog to access the

Create or Open native Google documents using GoogleDriveApi

微笑、不失礼 提交于 2019-12-04 20:09:48
I have been closely following the documentation for the Google Drive Android API and, all works great. I can create new text documents and read them back in using the mime type of text/plain . What I cannot do is create a native Google "Document" or "Spreadsheet." Actually, I can create them by using the mime type to application/vnd.google-apps.document or application/vnd.google-apps.spreadsheet as per Supported MIME Types documentation. If, however, I try to write content to these documents, the documents never get uploaded. If I try to read documents that have content (content I created via

Google Drive Rest API on Android

倾然丶 夕夏残阳落幕 提交于 2019-12-04 19:13:32
I'm developing an app for a company and I need to integrate it with Google Drive. I can't use the native API because the company has files not created by the application that needs to be handled, I need the full drive scope, so the REST API is what I must use. Here's the problem, the tutorials are not basic enough for me to get started since I only have a very basic understanding of JSON and REST. The tutorial: https://developers.google.com/drive/web/integrate-create As I understand it I need to create JSON in my Java code and then pass that through the example code? JSON { "action":"create",

List files from Google Drive and get downloadUrl for selected file in Android

[亡魂溺海] 提交于 2019-12-04 15:24:23
I am trying to show a list of files the user has on their Google Drive from my Android app and once the user has selected a file, I want to get the downloadUrl and the Bearer token for that account to give it to my application server to download it. I have been looking around and it seems very confusing. There are 2 SDKs, Android SDK and Java SDK ( REST based) for Google Drive. I successfully was able to get the list of files and display it using the Android SDK (I did not have to build any UI), and when the user selects a file, I got all the metadata about the file but the downloadUrl . I did