I am using PDF.js to show PDF files inside my Android App. Up to Android 10 it worked fine, but starting with "targetSdkVersion 30" it doesn't work anymore.
If I want to open and show a PDF file, PDF.js shows
Missing PDF "file:///storage/emulated/0/Android/data/<App-ID>/files/file.pdf
The path ist definitely correct, I checked it and generated it with getExternalFilesDir(null).absolutePath
The whole URL to load is
file:///android_asset/web/viewer.html?file=/storage/emulated/0/Android/data/<app-ID>/files/file.pdf
Using "targetSdkVersion 29" and changing nothing else, all works fine, so it seems "targetSdkVersion 30" causes somehow the problem.
The solution was pretty simple (shame on me):
Up to API 29 I only used:
Since API 30 I have to use: