Store number in any external file accessible if user reinstall the app

Hello Koders,

I am finding the best way to store a particular number for which the user is allowed until it reaches a specific limit say it 30 in a file “Limit.txt”.
I have tried saving a text file in the apps private directory but after uninstalling it will lost with the app.
The other is to save it in Google spreadsheet and read and increment it every time which requires network and is slow.
The best and ideal is to save it in a an external file which remains intact after user uninstall the app, which is not allowed in Android 11.

What will be the possible solution. Please give me a clue.

Could I save the Limit.txt file in Application Specific Directory ASD ?

That solution is not plausible as the external directory gets deleted when your application is installed.

You can create a hidden folder in SAF and save the file their

I have done like this,
1.Created a text file Named “Limit.30” and stored in Documents folder.
2.Copy it using Taifun file extension and read the number stored.
3.Modify it using EFile extension.
4.Copy back in Documents folder.

However it works perfectly in Companion but Not in the Installed Apk. Taifun and FileTools both File Copy Method is not working in the Apk.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.