Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67877

QDesktopServices::openUrl does not work with Android target API 27

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.15.1
    • 5.10.1, 5.15.0
    • Core: I/O
    • None
    • Android
    • 6f837d6f071e646282090c405ecfeb1e30454f42 (qt/qtbase/dev) f938ed38d2f60e105b8b24ad7b154e62c6c2952c (qt/qtbase/5.15)
    • 2020wk24, 2020wk26

      Device: Samsung galaxy s7
      Android: 7.0
      Cannot open file in default app which application downloaded to internal storage. This file can be opened if you navigate to it with any 3rdparty file explorer.

      Getting the following error:

      W System.err: android.os.FileUriExposedException: file:///storage/emulated/0/Documents/....book.pdf exposed beyond app through Intent.getData()
      W System.err: at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
      W System.err: at android.net.Uri.checkFileUriExposed(Uri.java:2346)
      W System.err: at android.content.Intent.prepareToLeaveProcess(Intent.java:9526)
      W System.err: at android.content.Intent.prepareToLeaveProcess(Intent.java:9484)
      W System.err: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
      W System.err: at android.app.Activity.startActivityForResult(Activity.java:4389)
      W System.err: at android.app.Activity.startActivityForResult(Activity.java:4348)
      W System.err: at android.app.Activity.startActivity(Activity.java:4672)
      W System.err: at android.app.Activity.startActivity(Activity.java:4640)
      W System.err: at org.qtproject.qt5.android.QtNative.openURL(QtNative.java:157)

      seems like we should use new android API (FileProvider):
      https://developer.android.com/training/secure-file-sharing/setup-sharing.html

        For Gerrit Dashboard: QTBUG-67877
        # Subject Branch Project Status CR V

            assam Assam Boudjelthia
            alexander.sh Alexander Shafirau
            Santtu Ahonen Santtu Ahonen
            Rami Potinkara Rami Potinkara
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes