[Interest] Qt Android - Targeting API 29 (Android 10): How to write to a non scoped location that is visible to the user via generic Files app?

Markus Haberlander markus.haberlander.sw at gmail.com
Wed May 25 12:11:05 CEST 2022


Hello,

I also had a hard time with that recently. I believe the possible
solutions (all need JNI AFAIK) are nicely described here:
https://stackoverflow.com/a/58379655/3859568
As far as I understood the related QTBUG entries, none of these will
be part of Qt5.

You wouldn't need these as long as using requestLegacyExternalStorage
and TARGET SDK 29 (as you write), because with that combination you
can write to user-visible locations anyhow, as you could before SDK
29, that's the purpose of this flag.

But anyhow: Can you really use Target API 29? Isn't API 30 required by
google now, which makes requestLegacyExternalStorage useless? API 30
is the default in Qt 5.15.9, too ...

And furtheron: Are you possibly using CMake, where setting the target
SDK is broken with Qt 5.15, as of
https://bugreports.qt.io/browse/QTBUG-103608 ?

Hope this helps,
Markus

Am Mi., 25. Mai 2022 um 02:38 Uhr schrieb Alexander Dyagilev
<alervdvcw at gmail.com>:
>
> Hello,
>
> These are the private folders of your application. As far as I know, QStandardPaths was changed to return them instead of public locations under Android.
>
> You should use Android APIs to get paths to public locations instead.
>
>
>
> On 5/13/2022 2:51 PM, Nuno Santos wrote:
>
> Hi,
>
> I’m having an hard time figuring out how to write files from a Qt Android app, to a location that is public to the user, outside of the scoped storage.
>
> I’m currently using Qt 5.15.9 and targeting API 29 (Android 10). I have set in my manifest requestLegacyExternalStorage=true
>
> And then I have tried to write a dummy file to the following StandardLocations:
>
> DesktopLocation - "/data/user/0/com.acme.org/files/test_file.txt"
> DocumentsLocation - "/storage/emulated/0/Android/data/com.acme.org/files/Documents/test_file.txt"
> MusicLocation - "/storage/emulated/0/Android/data/com.acme.org/files/Music/test_file.txt"
> PicturesLocation - "/storage/emulated/0/Android/data/com.acme.org/files/Pictures/test_file.txt"
> HomeLocation - "/data/user/0/com.acme.org/files/test_file.txt"
> GenericDataLocation - "/storage/emulated/0/Android/data/com.acme.org/files/test_file.txt"
> DownloadLocation - "/storage/emulated/0/Android/data/com.acme.org/files/Download/test_file.txt"
> GenericCacheLocation - "/data/user/0/com.acme.org/cache/test_file.txt”
>
> Then, with the files app I try to find any of the files without success… :(
>
> How do we write to public files to public locations, outside the scoped storage? Is it currently possible?
>
> Thanks in advance!
>
> Nuno
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list