How do you Overwrite an Existing File in Shared Scope (Documents)?

Try this one: test_2.aia (27.4 KB)

still it needs permission

Capture
just changed scope from shared to app then its not asking for permission and working fine. Please tell me why its asking for shared scope, i want to learn.. :slightly_smiling_face:

Yes, I already mentioned this issue here and here.

So I replaced the relevant blocks (critical methods) of the File component with my MFile extension and set FileScope = Legacy (instead of Shared).

test_2a.aia (27.2 KB)

1 Like

Thank You... :smiling_face_with_three_hearts:

Note:
If your app is also intended to run on Android devices below 11, storage permissions must of course be requested. However, in this case, it is sufficient to only request WRITE_EXTERNAL_STORAGE permission, as this also implicitly grants READ permission.

Both permissions (READ & WRITE, but only these two) are declared in the Manifest and can/must therefore be requested on Android ≤ 10.

1 Like

Understood. :slightly_smiling_face:

1 Like

yes i tried that , so deleted the above post

1 Like

Is it possible for the 'Pralaya' folder in the Documents directory to be automatically deleted upon app uninstallation? Currently, when I uninstall the app, the 'Pralaya' folder remains and is not deleted.

No. You should leave the folder (and file) in the ASD, as it will be automatically deleted when the app is uninstalled. Otherwise, your only option is to delete the folder each time the app goes to the background and recreate the folder and file when the app returns to the foreground.

actually the problem is when i reinstall the app and then when i try to save a file in that folder then it says

if i delete the Pralaya Folder then its working correct. is there a solution for this?

If the app is uninstalled and reinstalled, the newly installed app will be a new app. Therefore, the existing file cannot be overwritten. The possible solution is the one I described.

Since I want to retain these files, deleting the 'Pralaya' folder automatically when the app is in background would not be ideal.

Why? Why should the user be able to access the file(s) when the app is in the background?

user will copy the files to the computer

Ok, but why should then the folder be deleted when the app is uninstalled?

this is the issue in the pic of this post - error 1602

Then add a timestamp to the filename and tell the user to copy the latest file.

To be clear, I'm giving you hints, tips, and workarounds that are only necessary because Google's idiotic restrictions are increasingly limiting us all.

The fact that I can no longer overwrite or delete a file I created after reinstalling the app is, of course, also idiotic and pathetic.

1 Like