mDriveService.files (). list (). setSpaces ("диск"). execute ()); Не перечисляются все файлы с моего Google Диска - PullRequest
0 голосов
/ 01 августа 2020

В следующем коде я могу видеть все папки на Google Диске

public Intent createFilePickerIntent() {
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGOR`enter code here`Y_OPENABLE);
    intent.setType("application/json");

    return intent;
}

/**
 * Opens the file at the {@code uri} returned by a Storage Access Framework {@link Intent}
 * created by {@link #createFilePickerIntent()} using the given {@code contentResolver}.
 */
public Task<Pair<String, String>> openFileUsingStorageAccessFramework(
        ContentResolver contentResolver, Uri uri) {
    return Tasks.call(mExecutor, () -> {
        // Retrieve the document's display name from its metadata.
        String name;
        try (Cursor cursor = contentResolver.query(uri, null, null, null, null)) {
            if (cursor != null && cursor.moveToFirst()) {
                int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
                name = cursor.getString(nameIndex);
            } else {
                throw new IOException("Empty cursor returned for file.");
            }
        }

        // Read the document's contents as a String.
        String content;
        try (InputStream is = contentResolver.openInputStream(uri);
             BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
            StringBuilder stringBuilder = new StringBuilder();
            String line;
            while ((line = reader.readLine()) != null) {
                stringBuilder.append(line);
            }
            content = stringBuilder.toString();
        }

        return Pair.create(name, content);
    });
}

}

Но когда я выполняю простой mDriveService.files (). List (). SetSpaces (" диск "). execute ()); Я не могу видеть содержимое диска Google '

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...