Android Question Storing a file that cannot be deleted

Sub7

Active Member
Licensed User
Longtime User
I actually store a text file in dir.DirInternal but it get deleted in this way:
Settings > applications settings > appname > delete data.

I want that this file will only get deleted if the app is unistalled, rooted deviced excluded.


Thank you

"File.DirInternal / File.DirInternalCacheThese two folders are stored in the main memory and are private to your application. Other applications cannot access these files.
The cache folder may get deleted by the OS if it needs more space"

But also dirInternal get deleted what i doing wrong?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
File.DirInternal is deleted when your app is uninstalled or if the user explicitly deletes the app data (which resets the app state).

You can use any custom folder on the "external storage" to save the data. This folder will not be deleted when the app is uninstalled or when the user deletes the app data. However the user will be able to manually delete it.

There isn't any folder that is is only accessible to your app and is not deleted when the user presses on the delete data button.
 
Upvote 0

Sub7

Active Member
Licensed User
Longtime User

Thank you, for now i did a little woodo by adding this on manifest:
SetApplicationAttribute(android:manageSpaceActivity=".main"> This will prevent data delete from settings > apps. users can still delete the file manually.
However i will change it asap following your advices.

Thank you.
 
Upvote 0

bsnqt

Active Member
Licensed User
Longtime User
Can we store the text file in File.DirAssets? But it cannot be created on runtime?...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…