0

I have some files in a Google Drive folder created using the Google Web API.

Now I want to list the files and then read the contents.

I am not able to list the files using Android Google Drive APIs using Google's example code:

    Task<MetadataBuffer> queryTask = getDriveResourceClient().queryChildren(folder, query);
    // END query_children]
    queryTask
            .addOnSuccessListener(this,
                    metadataBuffer -> mResultsAdapter.append(metadataBuffer))
            .addOnFailureListener(this, e -> {
                Log.e(TAG, "Error retrieving files", e);
                showMessage(getString(R.string.query_failed));
                finish();
            });
    }
}

I am not sure if this is possible or I am making any mistake.

File Listing results:

-----------------------------
07-29 20:57:50.587 9722-9722/com.shasratech.s_c_31 I/DT-Google-drive: In case GOOGLE_DRIVE_GET_FILE calling findChild
07-29 20:57:50.692 9722-10478/com.shasratech.s_c_31 I/DT-Google-drive:  File Title = DT-DBB-29-07-2018 20:57:19.sqlite
07-29 20:57:50.693 9722-10478/com.shasratech.s_c_31 I/DT-Google-drive:  File Title = DT-DBB-29-07-2018 20:26:46.sqlite
--------------------------------

where as there is another file created by Web API which is not listed.

tehhowch
  • 9,645
  • 4
  • 24
  • 42
  • Even though Android Drive API use requires the `drive.file` scope, you should still include that information in your question. This scope likely means you haven't opened that file with your app yet, and thus cannot match it to a query - as explained on the page you link. – tehhowch Jul 29 '18 at 15:46
  • possible duplicate of https://stackoverflow.com/a/34254003 – ReyAnthonyRenacia Jul 30 '18 at 03:05
  • Thanks for the reply, – Arun Ayachith Jul 31 '18 at 02:13
  • Hi Techhowch, Thanks for the reply. I have given Bothe FILE and FOLDER scope. reqScp.add(Drive.SCOPE_FILE); reqScp.add(Drive.SCOPE_APPFOLDER); its like this. 1) Create random number of files from Google Drive Web API. They are dynamically created and every hour. 2) Now we need to read this data in Android App. I am not sure, 1] why restriction of not listing same users other files from Android Drive API. 2] Are there any examples of using REST API in android programs using Android-studio, so that I can get the files listed in my App. Thanks Arun Ayachith – Arun Ayachith Jul 31 '18 at 02:27

0 Answers0