In my application I store the path of image in my SQlite db for further use. The path that I get is
content://com.android.providers.media.documents/document
The code listed below,
// kitkat fixed (broke) content access; to keep the URIs valid over restarts need to persist access permission
if(Utils.isKitkat())
{
final int takeFlags = data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION);
ContentResolver resolver = getActivity().getContentResolver();
for (Uri uri : images)
{
resolver.takePersistableUriPermission(uri, takeFlags);
}
}
worked fine for me, anyway I noticed that the max number of persistable uri granted to my app is limited to 128. If I select more than 128 uri, I get the error:
java.lang.SecurityException: Permission Denial: opening provider........
just when I try to process an image for which I wasn't able to persist the permission. Can you figure out any solution?