Setup Setup Android Google Drive REST API.
val query = ...val safeQuery = query.replace("'", "\\'")var pageToken: String? = nulldo { val result = driveService.files().list().apply { q = "mimeType='application/vnd.google-apps.spreadsheet' and name contains '$safeQuery'" spaces = "drive" fields = "nextPageToken, files(id, name)" this.pageToken = pageToken }.execute() for (file in result.files) { Timber.d("name=${file.name}, id=${file.id}") }} while (pageToken != null)
NOTE: List of Google Drive MIME Types. Mime query could be "mimeType='image/jpeg'
or mimeType contains 'image/'
as well.
References: