[Interest] Problems writing files to Android file system on some newer devices using QStandardPaths
Jérôme Godbout
godboutj at amotus.ca
Tue May 25 15:22:57 CEST 2021
Where the standard path resolve on the device?
On Android 10, they changed the way we can access the file system, you can opt out with android:requestLegacyExternalStorage=“true” but this flag doesn’t work for Android 11+. If removing this flag break your applications, it means your application won’t work on any Android 11 devices.
The application are now sandboxed, Android 10 make it optional, Android 11 enforce it. You need to move to scoped storage.
https://developer.android.com/about/versions/11/privacy/storage
Jérôme Godbout, B. Ing.
Software / Firmware Team Lead
O: (418) 682-3636 ext.: 114
C: (581) 777-0050
godboutj at dimonoff.com<mailto:godboutj at dimonoff.com>
[signature_862523546]<https://www.dimonoff.com/>
dimonoff.com<https://www.dimonoff.com/>
1015 Avenue Wilfrid-Pelletier,
Québec, QC G1W 0C4, 4e étage
From: Interest <interest-bounces at qt-project.org> on behalf of Nuno Santos <nuno.santos at imaginando.pt>
Date: Monday, May 24, 2021 at 8:17 AM
To: Qt Interest <interest at qt-project.org>
Subject: [Interest] Problems writing files to Android file system on some newer devices using QStandardPaths
Hi,
Is anyone aware of changes to the way that Android filesystem works and how Qt interacts with it?
I’ve been writing to QStandardPaths::DocumentLocations without any issues until. However, on some newer devices, it fails to open files for writing. One example is Samsung Tab A (SM-T500)
It seems though that using android:requestLegacyExternalStorage=“true” seems to fix the problem but this solution will not last long because it seems it will be ignored when the app targets API 30 (Android 11):
https://developer.android.com/training/data-storage/use-cases
Caution: After you update your app to target Android 11 (API level 30), the system ignores the requestLegacyExternalStorage attribute<https://developer.android.com/about/versions/11/privacy/storage#scoped-storage> when your app is running on Android 11 devices, so your app must be ready to support scoped storage and to migrate app data<https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage> for users on those devices.
Is there any common knowledge about this?
Thanks!
Regards,
Nuno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210525/cecfca80/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13927 bytes
Desc: image001.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210525/cecfca80/attachment.png>
More information about the Interest
mailing list