[Interest] Sharing Files on Android

Kyle Nusbaum kjn at 9project.net
Tue Nov 1 02:33:27 CET 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20221031/a387683e/attachment.htm>


More information about the Interest mailing list