Reputation: 389
I have been trying to integrate google drive sdk in my android application. It all seems to work fine but now i have a requirement where in i would like to list out all the files with the same extension. For example I would like to get a list of all JPG files that the user might have saved to his google drive. For doing this i tried to use the following
FileList temp = service.files().list().setQ("title contains 'jpg'").execute();
But this does not return me anything.
On the other hand if i replace jpg with one of the words in the file name then it seems to work fine. So strangely a search on extension is not working while a search on the main name seems to work
Is this functionality broken with the drive sdk or am i missing something here?
Upvotes: 1
Views: 395
Reputation: 389
From the comment left by Burcu Dogan it is clear that at this point of time querying based on file extensions is not possible. Will have to wait for an update to the google drive sdk to include such functionality.
Putting this out as a note to help anyone who might be facing a simialr issue and looking for a solution.
Upvotes: 0
Reputation: 13528
Google Drive determines file types based on their mimeType attribute, not their extension. Instead of looking at the file name, try something like:
FileList temp = service.files().list().setQ("mimeType = 'image/jpeg'").execute();
Upvotes: 2