App getting crash and logged issue -
Caused by java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.docs.storagebackend.StorageBackendContentProvider from ProcessRecord (pid=23306, uid=10207) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
i am using this code:
val intent = Intent()
intent.type = "image/*"
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
intent.action = Intent.ACTION_OPEN_DOCUMENT
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
} else {
intent.action = Intent.ACTION_GET_CONTENT
}
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
//Make sure to only display images that can be opened as an inputstream so we can upload them
intent.addCategory(Intent.CATEGORY_OPENABLE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
}
startActivityForResult(intent, requestCode)
Content resolver used in JobIntent
service:
contentResolver.openInputStream(uri)
How can we resolved this isue?