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