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. New to android/IOs app. Needs help bundeling help as html file in app and opening it in browser

New to android/IOs app. Needs help bundeling help as html file in app and opening it in browser

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 3 Posters 1.1k 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.
  • C Offline
    C Offline
    Cyrille de Brebisson
    wrote on last edited by
    #1

    Hello,

    I am new to IOs and Android.
    My app uses a html file as "help" to explain how to use my app and I have a "help" button in the app that needs to cause the OS to open said html file.
    I was able to get the system working in windows/mac by copying my help folder in the same folder as the app executable before creating the install packages and then calling
    QDesktopServices::openUrl(QUrl::fromLocalFile(getAppPath()+"/help/help.htm")); when the help button is pressed.

    However, I have NO idea how to do this in Android and IOs?

    Can anyone tell me how/where to copy my help files, how to add them in the apk and IOs install files?

    Thanks,
    Cyrille

    J.HilkJ 1 Reply Last reply
    0
    • C Cyrille de Brebisson

      Hello,

      I am new to IOs and Android.
      My app uses a html file as "help" to explain how to use my app and I have a "help" button in the app that needs to cause the OS to open said html file.
      I was able to get the system working in windows/mac by copying my help folder in the same folder as the app executable before creating the install packages and then calling
      QDesktopServices::openUrl(QUrl::fromLocalFile(getAppPath()+"/help/help.htm")); when the help button is pressed.

      However, I have NO idea how to do this in Android and IOs?

      Can anyone tell me how/where to copy my help files, how to add them in the apk and IOs install files?

      Thanks,
      Cyrille

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      Hi @Cyrille-de-Brebisson

      Even though there are ways to bundle raw files with your iOS/Android app, I would suggest using Qt's Ressource system to ship the html file. It's the most cross platform method and requires little setup

      However you won't be able to load that file in a browser. For that you would have to copy it to a temporary location, using QStandardPath::writeableLocation with QStandardPaths::TempLocation as argument. Than you can pass that location to your QDesktopService.


      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
      1
      • C Offline
        C Offline
        Cyrille de Brebisson
        wrote on last edited by
        #3

        Hello,

        I tried placing the files in resources and copy them in a temp location.
        It does work in Windows, however, it does not on Android where I get the following error message:
        W System.err: android.os.FileUriExposedException: file:///data/user/0/org.qtproject.example.................../help.htm exposed beyond app through Intent.getData()

        Any other suggestions?

        Cyrille

        jsulmJ 1 Reply Last reply
        0
        • C Cyrille de Brebisson

          Hello,

          I tried placing the files in resources and copy them in a temp location.
          It does work in Windows, however, it does not on Android where I get the following error message:
          W System.err: android.os.FileUriExposedException: file:///data/user/0/org.qtproject.example.................../help.htm exposed beyond app through Intent.getData()

          Any other suggestions?

          Cyrille

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Cyrille-de-Brebisson Are you trying to write into apps directory? If so then it's not going to work.
          You should search for a writeable location, see http://doc.qt.io/qt-5/qstandardpaths.html#standardLocations
          QStandardPaths::TempLocation

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • C Offline
            C Offline
            Cyrille de Brebisson
            wrote on last edited by
            #5

            Hello,

            I was trying to write them to the temp directory!

            Being unable to "fix" this, I ended up changing things and I added a webView page in my application and have this web view directly load the files from my app resource. Disgusting solution as it means that the files are hard enabled in the .exe, but it works.

            Cyrille

            jsulmJ 1 Reply Last reply
            0
            • C Cyrille de Brebisson

              Hello,

              I was trying to write them to the temp directory!

              Being unable to "fix" this, I ended up changing things and I added a webView page in my application and have this web view directly load the files from my app resource. Disgusting solution as it means that the files are hard enabled in the .exe, but it works.

              Cyrille

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Cyrille-de-Brebisson I found here something: https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

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