Important: Please read the Qt Code of Conduct -

Share files from QStandardPath on Android 10 throws Permission exception

  • Hello guys ad Qt experts,

    I am using the approach of sharing files from QStandardPath::WritableLocation via an Android-Intent using FileProvider to get Content Url. This approach works nie up to Android 9. On Android 10 (Google Pixel 4) I am getting following error from Java-Code:

    D EuroSoft live: Share Pdf from:  "/data/user/0/com.systronik.eurosoftlive/files/reports/report.pdf"
    E DatabaseUtils: Writing exception to parcel
    E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading uri content://com.systronik.eurosoftlive.fileprovider/saveddata/reports/share/report_20200427_104948.pdf from pid=23680, uid=1000 requires the provider be exported, or grantUriPermission()
    E DatabaseUtils: 	at android.content.ContentProvider.enforceReadPermissionInner(
    E DatabaseUtils: 	at android.content.ContentProvider$Transport.enforceReadPermission(
    E DatabaseUtils: 	at android.content.ContentProvider$Transport.query(
    E DatabaseUtils: 	at android.content.ContentProviderNative.onTransact(
    E DatabaseUtils: 	at android.os.Binder.execTransactInternal(
    E DatabaseUtils: 	at android.os.Binder.execTransact(

    Do you have an idea what could cause this problem? My speculation is, that new file handling on Android 10 could lead to this issue...
    Scoped storage in Android 10 (

    Have anyone got some experience with this topic?

    Regards Mike

  • Anybody has a hint where to search for or where to ask? Stackoverflow? Android forums?

  • As I'm struggling with a similar issue, and reading lots of articles I come to the conclusion that google has released the "scoped file access" monster to soon. As they realized this very well they have provided us programmers with an opt-out: Add the following to the AndroidManifest.xml of your app:

    <application android:requestLegacyExternalStorage="true" .......

    Hope this works for you to ( as long as they support it )

  • Moderators

    @MikeWhite and @JeanC

    take a look at this blog post made by @ekkescorner

    In it, he explains in detail how to use the new permission system to write to android storage to exchange data. What cpp code is required where and what you have to add to your android manifest etc.

    It should contain everything you need to know.

Log in to reply