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

QDesktopServices is unable to open a file on Android

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.4.1
    • 5.5.0, 6.2.2
    • QPA
    • None
    • Android
    • 2756660453 (qt/qtbase/6.3) 2756660453 (qt/tqtc-qtbase/6.3) ed5474aa60 (qt/tqtc-qtbase/6.4.1)
    • 2022wk34FOQtforAndroid, 2022wk36FOQtforAndroid, 2022wk38FOQtforAndroid, 2022wk40FOQtforAndroid, 2022wk42FOQtforAndroid

    Description

      Using QDesktopServices to open a file in default text editor fails with error:

      W/System.err(14268): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///sdcard/tmp/patchfull_14268_temp_2015_08_27_16_22_15_0.log }
      W/System.err(14268): 	at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1765)
      W/System.err(14268): 	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1485)
      W/System.err(14268): 	at android.app.Activity.startActivityForResult(Activity.java:3736)
      W/System.err(14268): 	at android.app.Activity.startActivityForResult(Activity.java:3697)
      W/System.err(14268): 	at android.app.Activity.startActivity(Activity.java:4007)
      W/System.err(14268): 	at android.app.Activity.startActivity(Activity.java:3975)
      W/System.err(14268): 	at org.qtproject.qt5.android.QtNative.openURL(QtNative.java:110)
      

      I provide projects files with example:

      • Compiled on PC, it shows one button to open the created file. It uses QDesktopServices and works
      • Compiled on Android, it shows two buttons to open the file. First button use the same code as PC, it fails with error reported above. Second button uses a piece of code I wrote to open the file using QAndroidJniObject, it works.

      So, file can be opened, but default Qt implementation in DesktopServices fails!

      Attachments

        1. main.cpp
          0.2 kB
        2. mainwindow.cpp
          5 kB
        3. mainwindow.h
          0.2 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              assam Assam Boudjelthia
              jpo38 Jean Porcherot
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: