How do copy of Big not image file to ASD from non ASD directory

Thank you Anke, but I'm able to read small zip files (up to 5MB) with SAF.ReadAsByteArray from non ASD directory (file is chosen by the user with a help of SAF.OpenDocument) and save it in ASD without any problem.
It means that SAF is bypassing this security limits. The only problem that I need to read a big file and ReadAsByteArray is not able to allocate memory (because of integer usage).
I guess that this can be solved by using "upgraded" SAF.DocumentCopy that has to use the same mechanism as ReadAsByteArray but reading and saving file block by block (where each block can be less than 5MB).

Yes, I understood that. Hence my hint (upload the file to a server ...).
On Android 11+ you will have no (other) choice...

I'm testing the app on Android 12 and saf.readasbytearray is working perfectly with small files

Nice, and ...?

It means that the choice is already exists on Android 11+ for small files (it's SAF) and the problem is to upgrade SAF for big files

Again, I suggest saving this backup file to the app's private directory, then, if necessary, it can be copied to the ASD for "unzipping and elaboration". If the user wants to save to the cloud, then the file can be sent there too.

Yes, we got that - and ... what is the conclusion ... ?

Maybe I was not able to explain - it's a backup file and it was created by my app in ASD. But as a backup it has to be saved in secured place that gives possibility to restore this important data in case of smartphone damage or other problems. The solution is to save it on sd card reader connected via USB that is much more secure than the smartphone or cloud.
The user can save this backup on SD card in SD reader with a help of sharing function and it works. But I need to give him possibility to restore this backup file copying it back to ASD from SD card in SD card reader.
I can do it now with small backup files (up to 5mb) with SAF. But backup file can easily arrive to 100-200 mb and in this case SAF is giving a memory allocation error.
That's why I'm asking the developer of SAF to "upgrade" it in order to support big files.

I'm waiting for the answer from the developer is it feasible or not (proposing myself as a sponsor)

1 Like

The problem is that all app-specific directories (ASD & PrivateDir) are no longer available after uninstalling the app or losing the device. So there is no solution other than uploading the file to a server and downloading it when needed.

I was uninstalling completely my app and then , after the new installation, I can easily restore all info from the backup on SD card in SD reader, creating again an ASD on smartphone via APP. It works

:question:

What is not clear in my answer? You wrote that ASD is disappearing after disinstalation. Its obvious. But it's also obvious that once reinstalled an app on this or new smartphone - the app will recreate an ASD and can restore all user data from backup file saved on SD card in SD reader.
I've done it already for small files. It works.

The crucial question is who is modifying the file in question (.zip)? If this isn't the user then the whole problem should be easily solvable - if the problem ever existed.

Sorry, Anke. I can't understand you. Why do somebody need to modify a backup file?!
I have only one problem - how to copy big file from the SD card in SD reader to ASD? That's all. Is it possible to receive an answer from the developer of SAF about related sponsored upgrade?
Sorry, but now I'm going to sleep. It's already about 2 o'clock here :disappointed:

Yes, offcourse.

I already asked that: Who creates the zip file and who changes it and is it changed at all? What is your app about? It's always the same questions... and that's why I made my guide "How to ask a question".

Maybe I was not able to explain - it's a backup file and it was created by my app in ASD. But as a backup it has to be saved in secured place that gives possibility to restore this important data in case of smartphone damage or other problems. The solution is to save it on sd card reader connected via USB that is much more secure than the smartphone or cloud.
The user can save this backup on SD card in SD reader with a help of sharing function and it works. But I need to give him possibility to restore this backup file copying it back to ASD from SD card in SD card reader.
I can do it now with small backup files (up to 5mb) with SAF. But backup file can easily arrive to 100-200 mb and in this case SAF is giving a memory allocation error.
That's why I'm asking the developer of SAF to "upgrade" it in order to support big files.

If you can do it - what are the next steps? It will be my first experience as a sponsor

Can you please answer this simple question? @Alexandre_Gorine