I have an app that needs access to the gallery of the user to let it choose an image and perform transformations on it. I'd like to port this feature to the instant app experience. I know that the READ_EXTERNAL_STORAGE
permission is not available for instant apps but with an ACTION_GET_CONTENT
or with new ActivityResultContracts.GetContent()
we don't need it.
I'm able to open the gallery and to choose a picture but I got this error when I try to access it:
class j1.q: Failed to load resource
There were 3 causes:
java.io.FileNotFoundException(No content provider: content://com.android.providers.media.documents/document/image%3A221)
java.io.FileNotFoundException(No content provider: content://com.android.providers.media.documents/document/image%3A221)
java.io.FileNotFoundException(No content provider: content://com.android.providers.media.documents/document/image%3A221)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 4): class j1.q: Fetching data failed, class java.io.InputStream, LOCAL
There was 1 cause:
java.io.FileNotFoundException(No content provider: content://com.android.providers.media.documents/document/image%3A221)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.io.FileNotFoundException: No content provider: content://com.android.providers.media.documents/document/image%3A221
Cause (2 of 4): class j1.q: Fetching data failed, class android.os.ParcelFileDescriptor, LOCAL
There was 1 cause:
java.io.FileNotFoundException(No content provider: content://com.android.providers.media.documents/document/image%3A221)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.io.FileNotFoundException: No content provider: content://com.android.providers.media.documents/document/image%3A221
Cause (3 of 4): class j1.q: Fetching data failed, class android.content.res.AssetFileDescriptor, LOCAL
There was 1 cause:
java.io.FileNotFoundException(No content provider: content://com.android.providers.media.documents/document/image%3A221)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.io.FileNotFoundException: No content provider: content://com.android.providers.media.documents/document/image%3A221
Cause (4 of 4): class j1.q: Failed LoadPath{HierarchicalUri->Bitmap->Bitmap}, LOCAL
Cause (1 of 1): class j1.q: Failed DecodePath{HierarchicalUri->Bitmap->Bitmap}
I have seen this question from 4 years ago Not able to launch Gallery from Android Instant app
Now we are able to open the gallery so maybe there were some changes done on this topic from the google side.
Is anyone able to get a picture from the gallery on an instant app?