Требует, чтобы вы получили доступ с помощью ACTION_OPEN_DOCUMENT или связанных API - PullRequest
0 голосов
/ 27 февраля 2020

java .lang.SecurityException: Отказ в разрешении: открытие поставщика com. android .providers.media.MediaDocumentsProvider из ProcessRecord {6f31548 13761: com.spotbros.enterprise / u0a88} (pid = 13761, uid = 10088) требует, чтобы вы получили доступ с помощью ACTION_OPEN_DOCUMENT или связанных API

, и это код, в котором я ловлю исключение:

if (scheme.equals("content")) {
        Cursor c = null;
        try {
            c = SpotbrosApplication.getAppContext().getContentResolver().query(uri, null, null, null, null);
            int dataColumnIndex = c.getColumnIndex(MediaStore.MediaColumns.DATA);
            if (dataColumnIndex != -1) {
                // Simplest case: the query returns a column named "_data" with the file real path.
                if (!c.moveToFirst()) {
                    // The cursor returned empty for any reason.
                    return null;
                }
                return c.getString(dataColumnIndex);
            }
            /*
             * The query has not returned the "_data" column, so, as far as we know, the file may well be coming in
             * from Google Drive over Lollipop.
             */
            return copyGDriveFileToFilesFolder(SpotbrosApplication.getAppContext(), uri);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (c != null) {
                c.close();
            }
        }
    } 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...