Do you know how to deal with the new file providers?
I'm targeting android 33 and I've replaced READ_EXTERNAL_STORAGE with READ_MEDIA_AUDIO.
Then I declared a provider in the manifest and added res/xml/file_paths.xml:
Code: Select all
<paths><external-path name="external_storage" path="."/></paths>
In the activity, I'm calculating the URI with:
Code: Select all
Uri playlistUri() {
var playlist = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC), "list.m3u8");
return FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".fileprovider", playlist);
}
and launching the intent you suggested to me:
Code: Select all
Intent tcIntent() {
return new Intent("com.ghisler.android.TotalCommander.MediaPlayerActivity")
// .setData(playlistUri())
.setDataAndType(playlistUri(), "audio/x-mpegurl")
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
I tried all the variations of the code above (data, dataAndType, with and without flag), but I always receive:
Code: Select all
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.ghisler.android.TotalCommander.MediaPlayerActivity dat=content://{APPLICATION_ID}.fileprovider/... typ=audio/x-mpegurl flg=0x1 }