google-drive-android-api

How to upload a file to google drive folder using android google drive sdk

只谈情不闲聊 提交于 2019-11-29 12:01:09
Using the bellow snippet I am able to access folder which I have already created with the same app. I am using 'com.google.android.gms:play-services-drive:9.0.0' library and referring google drive sample on github . using the sample CreateFolderInFolderActivity.java I am able to create folder inside an existing folder. Instead of creating folder I need to create a file inside existing folder. public class CreateFileInsideFolderActivity extends BaseDemoActivity { private static final String TAG = "CreateFileActivity"; @Override public void onConnected(Bundle connectionHint) { super.onConnected

App Folder files not visible after un-install / re-install

时光总嘲笑我的痴心妄想 提交于 2019-11-29 11:41:56
I noticed this in the debug environment where I have to do many re-installs in order to test persistent data storage, initial settings, etc... It may not be relevant in production, but I mention this anyway just to inform other developers. Any files created by an app in its App Folder are not 'visible' to queries after manual un-install / re-install (from IDE, for instance). The same applies to the 'Encoded DriveID' - it is no longer valid. It is probably 'by design' but it effectively creates 'orphans' in the app folder until manually cleaned by ' drive.google.com > Manage Apps > [yourapp] >

List all files in Drive

妖精的绣舞 提交于 2019-11-29 11:01:21
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>() { @Override public void onResult(DriveApi.MetadataBufferResult result) { if (!result.getStatus().isSuccess()) {

Android - access Google Drive appdata folder from another device, but same app

丶灬走出姿态 提交于 2019-11-29 09:56:55
问题 My app is setup to allow backups to be saved to a Google Drive appdata folder. It all works perfectly well on the same device. When I make a backup, delete the app's data, then restore it all works. However, when I try to backup on one device, then install on another and attempt to restore there are no files found. Same goes for when I uninstall the app on the original device, reinstall it on the same device and attempt to restore. Both cases result in no files being found despite the fact

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

廉价感情. 提交于 2019-11-29 08:55:36
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. seanpj 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 getContent()) to retrieve the file content get binary stream and save it to your SD card In both step 1

Listing files and folders of GDrive using Google Drive Api

北慕城南 提交于 2019-11-29 08:50:18
I want to list all files and folders of a directory on Google Drive using Google Drive API. But I am only getting Metadata object of files not of the folders present in the directory. I am using the following code DriveFolder folder = Drive.DriveApi.getRootFolder(getClient()); folder.listChildren(getClient()) .setResultCallback(new ResultCallback < DriveApi.MetadataBufferResult > () {@ Override public void onResult(DriveApi.MetadataBufferResult result) { if (!result.getStatus().isSuccess()) { L.c("Error in listing root folder"); return; } MetadataBuffer metadataBuffer = result

Using Google Drive to backup and restore SQLite Database

随声附和 提交于 2019-11-29 07:03:30
问题 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 the backup on the SD card. So having the backup in the same place as the original in this case, quite frankly defeats the purpose of having a backup. So I thought of using Google Drive as a safer place to keep the db file, that and it

Android Google drive App data folder return empty when I use queryChildren

那年仲夏 提交于 2019-11-28 18:46:17
I'm using the new Google play service drive api to implement backup and restore data with App folder in my android application.I followed the intructions from the google drive developer guides.I can backup and restore data successfully when I only use one device and don't uninstall and reinstall the app.But Problem appears when I use two devices or unintall and reinstall the app. Scene 1: I install my app on one device and backup data to "App folder" succeed and I can see the data size of my app folder changed in Google drive "Manage apps",then I install my app on another device and try to use

How to acknowledge when user doesn't want to connect to Google Play Services?

半世苍凉 提交于 2019-11-28 14:32:12
If a user who is prompted to let my app access their Google Drive account hits "cancel," is there a way to acknowledge that they clicked cancel? Right now my application continuously asks them to choose a Google Drive account to use. This is the code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // This is the XML for this activity setContentView(R.layout.view_all_timelines_activity); // This is used for authentication and uploading to Google Drive googleApiClient = new GoogleApiClient.Builder(this).addApi(Drive.API) .addScope(Drive.SCOPE_FILE

Google Drive Android API Change Notifications not working

可紊 提交于 2019-11-28 14:28:06
I am using Google Drive Android API sample and in that sample i am able to create file and folder in Drive but if i want to monitor change events for a file which is cretaed by this app then it is not working. https://github.com/googledrive/android-demos in this sample there is one activity to receive notfiications for change event in a file, which is not working. I am not seeing any notification when i changed metadata of selected file from web. Changes from the web are not instantaneously reflected on the device. You will get notified when the device finds out about the change. You can speed