Is it possible to open an album in Android Gallery starting from sdk v24?
I have an application that manipulates an image and saves it to the external storage under specific album name. I would like to have a possibility from the application to open that album directly in Android Gallery. Is it possible to achieve that?
I can easily open a single file, but not the whole album:
My AndroidManifest.xml
...
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
...
My provider_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
My handling of opening a specific file:
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
File myFile = new File(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), MY_ALBUM_NAME), MY_FILE_NAME);
Uri myUri = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", myFile);
i.setDataAndType(myUri, "image/*");
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(i);
Opening a specific file works just fine. However, I cannot make it to open the whole album. Is that possible?