HBiSoft / PickiT

An Android library that returns real paths from Uri's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Caused by java.lang.SecurityException: Permission Denial

ahmadbajwa8282 opened this issue · comments

implementation 'com.github.HBiSoft:PickiT:2.0.3'

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
       at android.os.AsyncTask$4.done(AsyncTask.java:415)
       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
       at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
       at java.util.concurrent.FutureTask.run(FutureTask.java:271)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.SecurityException: Permission Denial: reading com.google.android.apps.docs.storagebackend.StorageBackendContentProvider uri content://com.google.android.apps.docs.storage/document/acc%3D2%3Bdoc%3Dencoded%3D0ap1EmWcFP7yBkFDVTwpCmtcuoPnD-uU5gpAc4SJwf86WBFPVc_gwMyIbZjh from pid=18854, uid=10543 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2385)
       at android.os.Parcel.createException(Parcel.java:2369)
       at android.os.Parcel.readException(Parcel.java:2352)
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
       at android.content.ContentProviderProxy.query(ContentProviderProxy.java:472)
       at android.content.ContentResolver.query(ContentResolver.java:1186)
       at android.content.ContentResolver.query(ContentResolver.java:1118)
       at android.content.ContentResolver.query(ContentResolver.java:1074)
       at com.hbisoft.pickit.DownloadAsyncTask.getFileName(DownloadAsyncTask.java:28)
       at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:209)
       at android.os.AsyncTask$3.call(AsyncTask.java:394)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

The issue is described in the log:

Caused by: java.lang.SecurityException: Permission Denial: reading com.google.android.apps.docs.storagebackend.StorageBackendContentProvider uri content://com.google.android.apps.docs.storage/document/acc%3D2%3Bdoc%3Dencoded%3D0ap1EmWcFP7yBkFDVTwpCmtcuoPnD-uU5gpAc4SJwf86WBFPVc_gwMyIbZjh from pid=6564, uid=10231 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs

You should use ACTION_OPEN_DOCUMENT instead of ACTION_GET_CONTENT

This issue was already opened here - #10

I'm already using ACTION_OPEN_DOCUMENT.

pdfPicker = PickiT(context, this, activity)
            val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
                addCategory(Intent.CATEGORY_OPENABLE)
                type = "application/pdf"
            }
            launchForPDF.launch(Intent.createChooser(intent, "ChooseFile"))