Reputation: 255
I ame making an System App for Google in android.which shares files from one Google account to another Google account.
As we know Android drive API have limited support for sharing operation.
For this purpose we are using Google APIs JAVA client.Now our problem is that we can not able to query the drive to get the folder id.
Also how can i query for files.Any one having any example like passing the query parameter "q".
Note:-I am using google-api-client-1.19.0.jar.
Anybody having some idea about this issue,please help us to resolve this issue.
Upvotes: 2
Views: 1157
Reputation: 5586
It seems to me your question is "how can I query Drive?"
I was in a very similar situation. your link is very close to revealing how to do this... Yet it does not. I only found this out by looking at Google's JavaDocs and seeing the method signature.
Use the code from the link you shared, but add setQ("My query string for searching")
to the .list()
call. Example:
Files.List request = service.files().list().setQ("my query string for searching files in Drive");
FileList files = request.execute();
Documentation on what can go into the .setQ()
To Google:
There are clear issues with Google Drive's docs. The only close example in Google Drive's docs is for retrieving ALL the files in Drive. Gee, that's useful. Why is there NO example of passing a query to Drive??? Should we really need to sleuth the Java DOCs for such an obvious / primary feature? And it speaks to the level of the Drive team's community engagement that no one has answered this question.
Upvotes: 1