[Interest] Sharing Files on Android
ekke
ekke at ekkes-corner.org
Tue Nov 1 07:20:06 CET 2022
Am 01.11.22 um 02:33 schrieb Kyle Nusbaum via Interest:
> Hi everyone.
>
> I have a question about opening files using Qt on Android.
> Specifically, I'm trying to open a pdf file that was downloaded
> through my application.
>
> Supposedly I should be using QDesktopServices::openUrl
> (https://doc.qt.io/qt-6/qdesktopservices.html#openUrl), which *sort*
> of works, in that It opens a list of apps. When I select one, though,
> it fails with:
> 10-31 20:24:39.631 9734 9734 E AndroidRuntime:
> java.lang.RuntimeException: Unable to start activity
> ComponentInfo{foundation.e.pdfviewer/com.gsnathan.pdfviewer.MainActivity_}:
> java.lang.SecurityException: Permission Denial: opening provider
> androidx.core.content.FileProvider from ProcessRecord{4283490
> 9734:foundation.e.pdfviewer/u0a115} (pid=9734, uid=10115) that is not
> exported from UID 10270
>
> I've had little success searching. It looks like I may need something
> like Intent.FLAG_GRANT_READ_URI_PERMISSION, but can't find in the Qt
> code where that would be used.
>
> Anyone have any experience using this function or otherwise using
> Intents with Qt on Android?
>
> Thanks,
> -- Kyle
Hi Kyle,
five years ago I did some work on Sharing Text and Files with Qt Apps on
Android and iOS. There's an example app:
https://github.com/ekke/ekkesSHAREexample and a 4-part-Blog starting
with this one:
https://www.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app
<https://www.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app>
Don't know if all still works with newest Android SDK API Level, but
perhaps you'll find some worthfully infos
next weeks / months I'll move from Qt 5.15 to Qt 6.5 and port all my
apps and rework all my old examples and take a look how all of this will
work best on Qt6 and blog again
ekke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20221101/a6b37fd6/attachment.htm>
More information about the Interest
mailing list