Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Share files from QStandardPath on Android 10 throws Permission exception
Forum Updated to NodeBB v4.3 + New Features

Share files from QStandardPath on Android 10 throws Permission exception

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 840 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MikeWhite
    wrote on last edited by
    #1

    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 android.support.v4.content.FileProvider 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(ContentProvider.java:729)
    E DatabaseUtils: 	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:602)
    E DatabaseUtils: 	at android.content.ContentProvider$Transport.query(ContentProvider.java:231)
    E DatabaseUtils: 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:104)
    E DatabaseUtils: 	at android.os.Binder.execTransactInternal(Binder.java:1021)
    E DatabaseUtils: 	at android.os.Binder.execTransact(Binder.java:994)
    

    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 (https://developer.android.com/about/versions/10/privacy/changes)

    Have anyone got some experience with this topic?

    Regards Mike

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MikeWhite
      wrote on last edited by MikeWhite
      #2

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

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JeanC
        wrote on last edited by
        #3

        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 )

        1 Reply Last reply
        0
        • J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @MikeWhite and @JeanC

          take a look at this blog post made by @ekkescorner
          https://www.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app

          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.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved