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. No permission to open file on Android with Qt 5.15

No permission to open file on Android with Qt 5.15

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 948 Views
  • 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.
  • P Offline
    P Offline
    Passi
    wrote on 3 Jun 2020, 11:01 last edited by
    #1

    Hi,

    I want to open a PDF file in Qt 5.15 on Android. I use

    QDesktopServices::openUrl(QUrl(file));
    

    to open the file. In Qt 5.15 this function should work on Android. (Bugfix from here: QTBUG-45585)
    Unfortunately I always get the error:

    Qt JAVA : openURL(): No permissions to open Uri
    

    If I test the permissions:

    qDebug() << "file: " << file;
    QFile f(file);
    qDebug() << "file exists: " << f.exists();
    f.setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser);
    qDebug() << f.permissions();
    

    I get the following:

    /storage/emulated/0/Documents/doc.pdf
    file exists:  true
    QFlags(0x20|0x40|0x200|0x400|0x2000|0x4000)
    

    I have set android permissions for READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE in manifest.xml and also proofed the permission by:

    QtAndroid::PermissionResult r = QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE");
     if(r == QtAndroid::PermissionResult::Granted) 
    ...
    

    If I generate a FileDialog to open the PDF there is no issue - the file opens normally.
    Does anyone have an idea or has anyone solved a similar problem?

    Thank you.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Passi
      wrote on 18 Jun 2020, 11:29 last edited by
      #2

      I opened a bug about this issue: QTBUG-85011

      1 Reply Last reply
      1

      • Login

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